Astropay (直接API経由)
Astropayを、DEUNAの直接APIを通じて、アプリケーションに支払い方法として統合します。
このページで
概要#
Astropayは、マルチ通貨アカウントを通じて、世界中で支払い、送金、受信を可能にするデジタルウォレットです。DEUNAは、Astropayをウォレット形式の支払い方法として統合します。
Astropayの決済フローは以下の通りです。
- ユーザーはAstropayを選択し、携帯電話番号を入力します。
- ユーザーはAstropayの承認ページにリダイレクトされ、注文に関するQRコード(および「リンクをコピー」オプション)が表示されます。
- ユーザーは、QRコードをスキャンするか、コピーしたリンクからAstropayアプリを開き、そこで支払いを確認します。
- ユーザーがアプリで承認すると、支払い状況はリアルタイムで確認されます。
要件:
- Astropay (DEUNA経由) は、現在以下の国で利用可能です。 アルゼンチン.
- ユーザーは、有効なAstropayアカウントを持っている必要があります。
- 環境:
- サンドボックス:
https://api.sandbox.deuna.io - 本番環境:
https://api.deuna.io
- サンドボックス:
APIによるAstropayの統合#
ステップ1: 注文の作成 POST /merchants/orders
支払い処理を開始するための注文を作成します。
リクエスト例
JSON
{
"order": {
"billingAddress": {
"address1": "Jose Luis Lagrange 123, Piso 12",
"address2": "Polanco I Sección",
"addressType": "home",
"city": "Buenos Aires",
"countryCode": "ARG",
"email": "jean.doe@example.com",
"firstName": "Jean",
"identityDocument": "205973330",
"identityDocumentType": "CC",
"lastName": "Doe",
"lat": -23.555425,
"lng": -46.677048,
"phone": "+5491100000000",
"stateName": "Buenos Aires",
"zipcode": "7521"
},
"browserDetails": {
"screenHeight": 1000,
"screenWidth": 2000
},
"currency": "ARS",
"items": [
{
"description": "Item description",
"id": "daed042a-4002-4144-850f-0797dcdfe833",
"imageUrl": "https://example.com/product.jpg",
"name": "Item #1",
"quantity": 2,
"taxAmount": {
"amount": 50,
"currency": "ARS",
"currencySymbol": "$"
},
"taxable": true,
"totalAmount": {
"amount": 2050,
"currency": "ARS",
"currencySymbol": "$",
"originalAmount": 2100,
"totalDiscount": 100
},
"unitPrice": {
"amount": 1050,
"currency": "ARS",
"currencySymbol": "$"
}
}
],
"orderId": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
"paymentMethod": "wallet",
"redirectUrls": {
"success": "https://example.com/success"
},
"shippingAddress": {
"additionalDescription": "confirm",
"address1": "Rua Exemplo 123",
"address2": "Bairro Exemplo",
"addressType": "home",
"city": "Buenos Aires",
"countryCode": "BRA",
"email": "jean.doe@example.com",
"firstName": "Jean",
"identityDocument": "205973330",
"identityDocumentType": "CC",
"lastName": "Doe",
"lat": -22.943934,
"lng": -43.182984,
"phone": "+5491100000000",
"stateName": "Buenos Aires",
"zipcode": "1406"
},
"shippingMethods": [
{
"code": "12345JR",
"cost": 250,
"name": "Standard shipping"
}
],
"storeCode": "all",
"subTotal": 5000000,
"totalAmount": 5000000,
"userInstructions": "Optional notes for the merchant",
"webhookUrls": {
"notifyOrder": "https://example.com/webhooks/order-status"
}
},
"orderType": "DEUNA_CHECKOUT"
}ステップ2: 支払い開始 POST /v2/merchants/orders/purchase
ステップ1で作成された注文/トークンを使用して、Astropayの承認を開始します。
リクエスト例
JSON
{
"order_token": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
"order_type": "DEUNA_CHECKOUT",
"payer_info": {
"email": "jean.doe@example.com",
"person_type": "UNKNOWN_PERSON"
},
"payment_source": {
"method_type": "wallet",
"processor": "astropay"
},
"anti_fraud_info": {
"device": {
"id": "0cddd683-12ba-4fca-9a5f-9d98c24d7312"
},
"session_id": "aa23e46d-edf0-4b2c-aa5d-10dc80070bf8",
"browser": {
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"color_depth": 24,
"language": "es",
"screen_height": 1440,
"screen_width": 2560
}
}
}応答
JSON
{
"order": {
"order_id": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
"transaction_id": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
"status": "pending",
"currency": "ARS",
"total_amount": 5000000,
"payment": {
"data": {
"method_type": "wallet",
"processor": "astropay",
"status": "pending",
"external_transaction_id": "92nAZK3PJQ4lrY3ln43CmV6Tbr8YqKXw5ykCpYwE",
"next_action": {
"action": "authorization_wallet",
"authorization_wallet": {
"redirect_url": "https://checkout-sandbox.astropay.com/payment/92nAZK3PJQ4lrY3ln43CmV6Tbr8YqKXw5ykCpYwE?data=..."
}
}
}
}
}
}3. ユーザーのリダイレクト
- URLを
payment.data.next_action.authorization_wallet.redirect_url. - ユーザーをそのURLにリダイレクトします。Astropayは、注文に関するQRコードと「リンクをコピー」オプションを含むページを表示します。ユーザーは、QRコードをスキャンするか、コピーしたリンクからAstropayアプリを開き、そこで支払いを確認します。
- ユーザーがアプリで支払いを確認すると、AstropayはユーザーをDEUNAのコールバックURL経由でリダイレクトします。
- ステップ2の直後、ステータスは
pending— ユーザーは、Astropayアプリで最終的な支払い状況を確認する必要があります。確認すると、ステータスはsucceededまたはdenied. - は、
order.webhookUrls.notifyOrder(ステップ1) に設定され、最終的な支払い状況が確認されます。
Webhooks:
- ウェブフックの登録については、DEUNAにお問い合わせください。
テスト:
アプリとの連携:
https://appdistribution.firebase.dev/i/1f9f7f6e5a7df8ba
https://testflight.apple.com/join/1WwzwYfz
12345678910 (任意の国コード) を使用
SMSコード: 000000