メインコンテンツへスキップ
このページで

このページは、DEUNA API を使用して PSE を統合するための手順を提供します。

以下の V2 エンドポイント 直接API連携向け。

V2 購入#

V2の購入処理は、リクエストに注文情報を追加することで、2つのステップを1つのエンドポイントで実行します。

V2の購入処理は以下の手順で行われます。

  1. ユーザーからの呼び出し POST v2/merchants/order/purchase CURLリクエストに注文情報を含めて送信します。
  2. DEUNA が注文を作成し、購入処理を実行します。

PSEをAPI経由で統合#

直接API連携はV2のプロセスに従います。

1. 利用可能な銀行を取得

購入を実行するにあたり、ユーザーは取引を行う銀行を選択する必要があります。

V2の「Purchase」エンドポイントへのリクエストを送信してください。 商用決済方法のエンドポイント 情報を取得するために。

結果として得られるレスポンスオブジェクトは、以下の構造を持つことになります:

JSON
{
  "@type": "type.googleapis.com/external_merchant_api.v1.GetPaymentMethodsResponse",
  "data": [
    {
      "enabled": true,
      "method_type": "bank_transfer",
      "processor_name": "payu_pse",
      "specific_fields": {
        "financial_institutions": [
          {
            "id": "1081",
            "description": "BANCO AGRARIO DESARROLLO",
            "url": ""
          },
          {
            "id": "1813",
            "description": "SANTANDER CONSUMER COLOMBIA",
            "url": ""
          }
        ]
      },
      "input_schema": [],
      "labels": {
        "es": ""
      },
      "exclude_cvv": false,
      "excluded_franchises": [],
      "extra_params": {},
      "installments": [],
      "credentials": {
        "public_api_key": "",
        "external_merchant_id": "",
        "customer_token": ""
      },
      "google_pay_credential": null,
      "stored_payment_methods": [],
      "id": "00000000-0000-0000-0000-000000000000",
      "payment_centers": [],
      "payment_provider": ""
    }
  ]
}

内部 specific_fields オブジェクトが存在します。 financial_institutions オブジェクトの配列を含む。以下の構造を持つ:

JSON
{
  "id": "1813",
  "description": "SANTANDER CONSUMER COLOMBIA",
  "url": ""
}

ユーザーへの情報の出力方法

配列内のオブジェクトを出力するには、 description フィールドをラベルとして使用してください。 ユーザーがオプションを選択したら、購入に必要な銀行情報を入力するための id および description フィールドを埋めるようにしてください。

2. V2 PSEでの購入

V2の「Purchase」エンドポイントへのリクエストを送信してください。 V2 Purchase endpoint.

DeunaでV2 PSEを購入するには、V2ペイロードには以下の情報が含まれている必要があります。

  • 注文データには、注文に関する情報が含まれている必要があります。
  • フルネーム
  • Номер документа
  • ドキュメントの種類
  • 電話番号
  • 個人または法人
  • 銀行
  • ユーザーをあなたのページにリダイレクトするためのコールバックURL

PSE取引を実行するために必要なフィールドを示すテーブル:

フィールド説明例
payer_infor.person_type個人または法人。LEGAL_PERSON
pse.financial_institution選択した銀行のコード1022
pse.financial_institution_name銀行名。BANCO UNION COLOMBIANO
callback_urls.on_successPSE取引が完了した後のリダイレクトURL。https://example.com/
browser_details.ip_addressユーザーが使用したブラウザのIPアドレス。155.95.122.206
billing_address.identification_type身分証明書の種類。利用可能な書類は以下のとおりです: CC,CE, TI, PP, NIT, RCおよびDE.CC
billing_address.identificationユーザーの身分証明番号。1234567890
billing_address.first_nameユーザーのファーストネーム。フアン
billing_address.last_nameユーザーの姓。ペレス
billing_address.phone電話番号を入力してください E.164format.+14155552671
billing_address.city請求対象の都市。ボゴタ
billing_address.street1請求対象のユーザーの主要な住所情報。アベニダ・カレラ72 80
billing_address.street2ユーザーへの請求に必要なアパートメントおよびスイートに関する情報。94
json
{
	"order_type": "DEUNA_CHECKOUT",
	"payer_info": {
		"email": "jrodriguez@gmail.com",
		"person_type": "NATURAL_PERSON" // Obtained from PSE form filled by the user
	},
	"callback_urls": {
		"on_success": "https://example.com/" // Redirection after completing PSE transaction
	},
	"payment_source": {
		"method_type": "bank_transfer",
		"processor": "payu_pse",
		"method_type_specific_fields": {
			"pse": {
				"financial_institution": "1022", // Code of selected bank, obtained from PSE form
				"financial_institution_name": "BANCO UNION COLOMBIANO" // Name of bank, obtained from PSE form
			}
		}
	},
	"order": {
		"order_id": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
		"store_code": "all",
		"currency": "COP",
		"total_tax_amount": 200000,
		"items_total_amount": 1900000,
		"sub_total": 1900000,
		"total_amount": 2100000,
		"items": [
			{
				"id": "79",
				"name": "10 ALITAS VOLANTE",
				"description": "10 alitas picantes",
				"options": "string option",
				"total_amount": {
					"amount": 1900000,
					"currency": "COP",
					"currency_symbol": "$"
				},
				"unit_price": {
					"amount": 850000,
					"currency": "COP",
					"currency_symbol": "$"
				},
				"tax_amount": {
					"amount": 100000,
					"currency": "COP",
					"currency_symbol": "$"
				},
				"quantity": 2,
				"uom": "string",
				"upc": "string",
				"sku": "SKU-11021",
				"isbn": "12-345-678-90123",
				"brand": "Bolt Swagstore",
				"manufacturer": "Bolt Factory",
				"category": "hats",
				"color": "Red",
				"size": "XXL",
				"weight": {
					"weight": 22,
					"unit": "kg"
				},
				"image_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
				"details_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
				"type": "physical",
				"taxable": true
			}
		],
		"billing_address": {
			"first_name": "Juan",
			"last_name": "Rodríguez",
			"email": "jrodriguez@gmail.com",
			"identification": "1234567890", // Document number obtained from PSE form
			"identification_type": "CC", // Document type obtained from PSE form
			"phone": "+578315263363",
			"address1": "Avenida Carrera 72 80",
			"address2": "94",
			"zipcode": "110110",
			"city": "Bogota",
			"state_name": "Bogota",
			"country": "CO"
		},
		"shipping_address": {
			"first_name": "Juan",
			"last_name": "Rodríguez",
			"email": "jrodriguez@gmail.com",
			"identification": "14201225",
			"identification_type": "CC",
			"phone": "+578315263363",
			"address1": "Avenida Carrera 72 80",
			"address2": "94",
			"zipcode": "110110",
			"city": "Bogota",
			"state_name": "Bogota",
			"country": "CO"
		},
		"browser_details": {
			"ip_address": "155.95.122.206"
		}
	}
}

3. ユーザーのリダイレクト

購入後、APIはリダイレクトURLを返します。 authorization_bank_transfer node.

  1. URLは、 authorization_bank_transfer node.
  2. ユーザーをそのURLにリダイレクトします。
  3. ユーザーが支払いを完了するのを待ちます。

    ユーザーはPSEで支払いを完了します。

  4. PayUのウェブフックを監視し、支払いの確認を行います。

応答

JSON
{
	"order_type": "DEUNA_CHECKOUT",
	"order_token": "db3fc147-2a4e-460f-a874-f6f79b1e651c",
	"order": {
		"order_id": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
		"store_code": "all",
		"currency": "COP",
		"tax_amount": 0,
		"display_tax_amount": "",
		"shipping_amount": 0,
		"display_shipping_amount": "COP 0,00",
		"items_total_amount": 1900000,
		"display_items_total_amount": "COP 19.000,00",
		"sub_total": 1900000,
		"display_sub_total": "COP 19.000,00",
		"total_amount": 2100000,
		"display_total_amount": "COP 21.000,00",
		"items": [
			{
				"id": "79",
				"name": "10 ALITAS VOLANTE",
				"description": "10 alitas picantes",
				"options": "string option",
				"total_amount": {
					"amount": 1900000,
					"original_amount": 0,
					"display_amount": "COP 19.000,00",
					"display_original_amount": "COP 0,00",
					"currency": "COP",
					"currency_symbol": "$",
					"total_discount": 0,
					"display_total_discount": "COP 0,00"
				},
				"unit_price": {
					"amount": 850000,
					"display_amount": "COP 8.500,00",
					"currency": "COP",
					"currency_symbol": "$"
				},
				"tax_amount": {
					"amount": 100000,
					"display_amount": "COP 1.000,00",
					"currency": "COP",
					"currency_symbol": "$"
				},
				"quantity": 2,
				"uom": "string",
				"upc": "string",
				"sku": "SKU-11021",
				"isbn": "12-345-678-90123",
				"brand": "Bolt Swagstore",
				"manufacturer": "Bolt Factory",
				"category": "hats",
				"color": "Red",
				"size": "XXL",
				"weight": {
					"weight": 22,
					"unit": "kg"
				},
				"image_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
				"details_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
				"type": "physical",
				"taxable": true,
				"discounts": [],
				"included_in_subscription": false,
				"subscription_id": "00000000-0000-0000-0000-000000000000",
				"item_details": []
			}
		],
		"discounts": [],
		"shipping_address": {
			"id": 0,
			"user_id": "",
			"first_name": "Juan",
			"last_name": "Rodríguez",
			"phone": "+578315263363",
			"identity_document": "",
			"lat": 0,
			"lng": 0,
			"address1": "Avenida Carrera 72 80",
			"address2": "94",
			"city": "Bogota",
			"zipcode": "110110",
			"state_name": "Bogota",
			"country_code": "CO",
			"additional_description": "",
			"address_type": "",
			"is_default": false,
			"created_at": "2025-01-20T16:49:38Z",
			"updated_at": "2025-01-20T16:49:38Z",
			"identity_document_type": "",
			"email": "jrodriguez@gmail.com",
			"state_code": "",
			"country": "CO"
		},
		"shipping_options": null,
		"user_instructions": "",
		"metadata": {},
		"status": "pending",
		"payment": {
			"data": {
				"amount": {
					"amount": 2100000,
					"currency": "COP"
				},
				"metadata": {
					"authorization_code": "",
					"reference_transaction_id": ""
				},
				"from_card": {
					"card_brand": "",
					"first_six": "",
					"last_four": "",
					"bank_name": "",
					"country_iso": "",
					"credential_source": ""
				},
				"updated_at": "2025-01-20 16:49:38.673262908 +0000 UTC",
				"method_type": "bank_transfer",
				"merchant": {
					"store_code": "all",
					"id": "2fe8d31e-f434-4628-869e-e894c13de929"
				},
				"created_at": "2025-01-20 16:49:38.67239479 +0000 UTC",
				"id": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
				"processor": "payu_pse",
				"customer": {
					"email": "Benny.Reynolds55@yahoo.com",
					"id": "56c3241c-5a7d-4f1b-99b6-b78cb78286a4",
					"first_name": "",
					"last_name": ""
				},
				"status": "pending",
				"reason": "",
				"external_transaction_id": "29e58cbf-051c-487a-8e3b-c37cb22be349",
				"authorization_bank_transfer": {
					"qr": "",
					"token": "",
					"expiration_date": "",
					"redirect_url": "",
					"reference": "4537041",
					"description": "Bank transfer transaction",
					"bank_name": "BANCO UNION COLOMBIANO",
					"external_transaction_status": "PENDING"
				},
				"merchant_payment_processor_name": "",
				"authorization_code": "",
				"installment_interest_calculations": null,
				"next_action": {
					"action": "authorization_bank_transfer",
					"authorization_bank_transfer": {
						"qr": "",
						"token": "",
						"expiration_date": "",
						"redirect_url": "https://sandbox.api.payulatam.com/payments-api/pse-caller?enc=aHR0cHM6Ly9yZWdpc3Ryby5kZXNhcnJvbGxvLnBzZS5jb20uY28vUFNFVXNlclJlZ2lzdGVyL1N0YXJ0VHJhbnNhY3Rpb24uYXNweD9lbmM9dG5QY0pITUtsU25tUnBITThmQWJ1em5HaEgySlNDcjQ5V1Y4YUttOGQ0eUJ4d0RvSmlrRGEwNFBjZE9Ca0JxSiMjanJvZHJpZ3VlekBnbWFpbC5jb20jIyMj",
						"reference": "",
						"description": "",
						"bank_name": "",
						"external_transaction_status": ""
					},
					"url": ""
				}
			}
		},
		"gift_card": [],
		"redirect_url": "",
		"webhook_urls": null,
		"total_discount": 0,
		"display_total_discount": "COP 0,00",
		"shipping": null,
		"cash_change": 0,
		"shipping_method": null,
		"shipping_methods": [],
		"timezone": "",
		"scheduled_at": "",
		"billing_address": {
			"id": 0,
			"user_id": "",
			"first_name": "Juan",
			"last_name": "Rodríguez",
			"phone": "+578315263363",
			"identity_document": "",
			"lat": 0,
			"lng": 0,
			"address1": "Avenida Carrera 72 80",
			"address2": "94",
			"city": "Bogota",
			"zipcode": "110110",
			"state_name": "Bogota",
			"country_code": "CO",
			"additional_description": "",
			"address_type": "",
			"is_default": false,
			"created_at": "2025-01-20T16:49:38Z",
			"updated_at": "2025-01-20T16:49:38Z",
			"email": "jrodriguez@gmail.com",
			"identity_document_type": "",
			"external_number": "",
			"internal_number": "",
			"country": ""
		},
		"payment_link": "",
		"display_shipping_tax_amount": "COP 0,00",
		"display_total_tax_amount": "COP 2.000,00",
		"shipping_tax_amount": 0,
		"total_tax_amount": 200000,
		"user_id": "",
		"include_payment_options": [],
		"redirect_urls": {
			"success": "",
			"pending": "",
			"error": "",
			"fallback": "",
			"close": ""
		},
		"created_at": "",
		"updated_at": "",
		"payer_info": null,
		"discount_amount": 0,
		"shipping_discount_amount": 0,
		"device_fingerprint": "",
		"expired_at": "",
		"version": "0",
		"fraud": null,
		"display_total_interest_amount": "",
		"payment_method": "",
		"token": "",
		"statement_descriptor": "",
		"browser_details": {
			"screen_height": 0,
			"screen_width": 0,
			"user_agent": "Mozilla/5.0 (Windows; U; Windows NT 6.3) AppleWebKit/532.0.1 (KHTML, like Gecko) Chrome/19.0.871.0 Safari/532.0.1",
			"ip_address": "41.3.66.146",
			"color_depth": 0,
			"java_enabled": false,
			"java_script_enabled": false,
			"language": "",
			"time_zone_offset": 0,
			"accept_header": ""
		}
	}
}