Notice
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 영수증확인
- meta
- 업로드
- php
- CSV
- 몇번째행
- closest
- google purchases
- Database
- 클릭이벤트막기
- Google_Service_AndroidPublisher
- slim install
- Google Pay
- 데이터베이스확인
- purchases_subscriptions
- MySQL
- 영수증인증
- google_purchases
- Google_Client
- SQL
- 영수증검증
- how to slim install
- 아파치
- purchases
- 데이터베이스 지정하기
- 테이블인덱스
- TABLE
- 리눅스
- subscriptionsv2
Archives
- Today
- Total
Web_developer
google 결제 영수증 확인 본문
반응형
<?php
//compser로 구글api 설치
include './vendor/autoload.php'; //구글api 로드
$client = new Google_Client(); //구글api 클래스 생성
$client->setAuthConfig('OAuth의 json파일 경로');
$client->addScope('https://www.googleapis.com/auth/androidpublisher');
$service = new Google_Service_AndroidPublisher($client);
$package_name = "프로젝트의 패키지명";
$product_id = '상품ID';
$jsonPath = ''OAuth의 json파일 경로';
$androidPublisher = 'https://www.googleapis.com/auth/androidpublisher';
$purchase_token = '클라이언트에서 발급받은 구매한 토큰값'; //주문관리에서도 토큰값을 확인할수있다
$purchase = $service->purchases_subscriptions->get($package_name, $product_id, $purchase_token);
$arr['kind'] = $purchase->kind;
$arr['startTimeMillis'] = $purchase->startTimeMillis;
$arr['autoRenewing'] = $purchase->autoRenewing;
//필요한 필드명은 본인의 소스에 맞게 제작
//구글api 참조
//https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions
$json = json_encode($purchase);
echo $json;
?>
해당 소스는 구독결제 관련 소스입니다.
일반 결제 (1회성 구매, 소모성구매) 는 purchases_products를 사용해야합니다.
2022.07.08 구글 영수증 검증 v2 사용법에 대하여 새롭게 포스팅했습니다.
response값이 좀더 명확하게 나와 분기 처리하기 좋습니다.
'PHP' 카테고리의 다른 글
google 영수증검증 REST v2 class (0) | 2022.07.08 |
---|---|
slim V4 - framework 설치하기 (0) | 2020.02.15 |
csv파일 행열 추가하기 fputcsv (0) | 2019.11.07 |
php에서 csv파일 로컬에 저장하기 (0) | 2019.11.04 |
file_put_contents(저장될tmp경로/저장될파일명, 파일경로) (0) | 2019.11.04 |