支払いVault
支払い情報を保存し、単回または将来の利用のためにトークン化
商社の体験
決済Vault
DEUNAのオーケストレーション
トークン化フローによって返される認証情報の範囲を理解する#
次の card_id DEUNAの決済認証情報への参照です。その利用可能性は、顧客の同意、トークンの種類、商社アカウント、プロバイダとの接続、環境、国、およびそのフローで有効になっている操作によって決まります。
- すべての保存された認証情報が、異なるプロセッサや決済方法間で移動可能であると仮定しないでください。
- 本番環境での利用前に、ネットワークトークン、アカウント更新、移植性、再利用、および削除の動作をターゲットアカウントで確認してください。
- PAN、CVV、プロバイダのトークン、およびプライベート認証情報をアプリケーションのログやメタデータから削除してください。
- 顧客、同意の目的、トークン化時間、認証情報のステータス、および許可された将来の使用を、システムの主要な記録に保存してください。
- トークンの削除を、自動的にキャンセルされたサブスクリプションとして扱うことなく、認証情報の無効化、有効期限切れ、置換、および顧客の削除をサポートしてください。
以下の プロバイダーの機能カタログ 接続のサポートと、アカウント固有の認証情報の動作について、DEUNAのテクニカルアカウントマネージャーと確認してください。
統合: DEUNA の SDK の使用#
Payment Vault の統合は、DEUNA の SDK を使用して行います。
Web環境では、ウィジェットをターゲットのHTML要素に開いたり、モーダルとして表示したりできます。
使用する SDK プラットフォームを選択:
Web SDKウェブスタックの任意の場所で使用できるJavaScriptとTypeScript。JavaScript · CDNReact NativeiOSとAndroidアプリの1つの統合。TypeScript · iOS + AndroidiOSネイティブiOSアプリケーション用のSwift SDK。Swift · SPMAndroidネイティブAndroidアプリケーション用のKotlin SDK。Kotlin · Gradle
機能
- SDKは、いくつかの機能を提供します。 コールバック これにより、商人は決済プロセス内の重要なイベントに動的に対応できるようになります。例えば:
- ユーザーがウィジェットを閉じた場合。
- カードまたは支払い情報が正常にトークン化された場合。
- トークン化の試行が失敗した場合。
- Payment Vault は、 埋め込み または、 モーダル.
詳細情報
Payment Vault の統合について詳しくは:
- イベントの種類とカードブランドの検証:Vault はイベントメタデータからカードブランドを認識します。
- Descuento aplicado si la tarjeta es Mastercard por el comerciante: カードが Mastercard の場合、現在のショッピングカートに 20% の割引が適用されます。 この処理は、完全にアプリケーション側で行われます。
- 注文の更新:割引を適用した後、注文の更新には、DEUNA の Update Order エンドポイントを使用する必要があります。
- 注文の状態変更に関するウィジェットへの通知と分割払い情報の更新:注文の状態変更は、SDK のコールバックを通じて伝達されます。
- プロモーションタグを表示する注文と決済金額の更新に加えて、アクティブなウィジェットにカスタムCSSスタイルを適用できます。
setCustomStyles(...). 詳細は、 Web SDK ガイド.
返されたものを使用して決済処理を行う card_id
DEUNAで、提供された情報を用いて支払処理を行うには、 card_id 次の方法を使用してください Purchase API.
例:curlリクエスト
JavaScript
const requestBody = {
payer_info: {
email: "eposada@deuna.com"
},
payment_source: {
method_type: "credit_card",
card_info: {
card_id: "8d369b6e-113a-4640-9e63-dc29957fc86a",
installment: {
plan_option_id: "<uuid que se retorna en el postMessage 'onInstallmentSelected'>"
}
}
},
// ... Remaining of the request body
};
fetch('https://api.sandbox.deuna.io/v2/merchants/orders/purchase', {
method: 'POST',
headers: {
'x-api-key': '<YOUR_PRIVATE_API_KEY>',
'Content-Type': 'application/json'
},
body: JSON.stringify(requestBody)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));curl --location 'https://api.sandbox.deuna.io/v2/merchants/orders/purchase' \
--header 'x-api-key: YOUR_PRIVATE_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"payer_info": {
"email": "foo@bar.com"
},
"payment_source": {
"method_type": "credit_card",
"card_info": {
"card_id": "8d369b6e-113a-4640-9e63-dc29957fc86a"
}
},
"order": {
"order_id": "testapi-0003",
"currency": "MXN",
"items": [
{
"id": "216",
"name": "10 Cellphones",
"description": "",
"options": "string option",
"total_amount": {
"original_amount": 2000,
"amount": 2000,
"currency": "MXN",
"currency_symbol": "$"
},
"unit_price": {
"amount": 200,
"currency": "MXN",
"currency_symbol": "$"
},
"tax_amount": {
"amount": 0,
"currency": "MXN",
"currency_symbol": "$"
},
"quantity": 1,
"uom": "string",
"upc": "string",
"sku": "",
"isbn": "",
"brand": "",
"manufacturer": "",
"category": "",
"color": "",
"size": "",
"weight": {
"amount": 0,
"unit": "kg"
},
"image_url": "https://images-staging.getduna.com/95463fb5-6279-4ec3-8ff9-fe07aacd2142/db5b698c57654116_domicilio_216_750x750_1662162887.png?d=200x200&format=webp",
"details_url": "",
"type": "physcal",
"taxable": true
}
],
"sub_total": 2000,
"total_amount": 2000,
"store_code": "all",
"billing_address": {
"address1": "presa angostura 36PH",
"address2": "",
"address_type": "home",
"city": "CDMX",
"country_code": "MX",
"email": "foo@bar.com",
"first_name": "efren",
"identity_document": "162915134",
"is_default": true,
"last_name": "garcia",
"phone": "+525222222222",
"state_code": "MX",
"state_name": "miguel hidalgo",
"zipcode": "11500"
}
}
}'const response = await fetch("https://api.sandbox.deuna.io/v2/merchants/orders/purchase", {
method: "POST",
headers: {
"x-api-key": "YOUR_PRIVATE_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"payer_info": {
"email": "foo@bar.com"
},
"payment_source": {
"method_type": "credit_card",
"card_info": {
"card_id": "8d369b6e-113a-4640-9e63-dc29957fc86a"
}
},
"order": {
"order_id": "testapi-0003",
"currency": "MXN",
"items": [
{
"id": "216",
"name": "10 Cellphones",
"description": "",
"options": "string option",
"total_amount": {
"original_amount": 2000,
"amount": 2000,
"currency": "MXN",
"currency_symbol": "$"
},
"unit_price": {
"amount": 200,
"currency": "MXN",
"currency_symbol": "$"
},
"tax_amount": {
"amount": 0,
"currency": "MXN",
"currency_symbol": "$"
},
"quantity": 1,
"uom": "string",
"upc": "string",
"sku": "",
"isbn": "",
"brand": "",
"manufacturer": "",
"category": "",
"color": "",
"size": "",
"weight": {
"amount": 0,
"unit": "kg"
},
"image_url": "https://images-staging.getduna.com/95463fb5-6279-4ec3-8ff9-fe07aacd2142/db5b698c57654116_domicilio_216_750x750_1662162887.png?d=200x200&format=webp",
"details_url": "",
"type": "physcal",
"taxable": true
}
],
"sub_total": 2000,
"total_amount": 2000,
"store_code": "all",
"billing_address": {
"address1": "presa angostura 36PH",
"address2": "",
"address_type": "home",
"city": "CDMX",
"country_code": "MX",
"email": "foo@bar.com",
"first_name": "efren",
"identity_document": "162915134",
"is_default": true,
"last_name": "garcia",
"phone": "+525222222222",
"state_code": "MX",
"state_name": "miguel hidalgo",
"zipcode": "11500"
}
}
})
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();import requests
response = requests.request(
"POST",
"https://api.sandbox.deuna.io/v2/merchants/orders/purchase",
headers={
"x-api-key": "YOUR_PRIVATE_API_KEY",
"Content-Type": "application/json"
},
json={
"payer_info": {
"email": "foo@bar.com"
},
"payment_source": {
"method_type": "credit_card",
"card_info": {
"card_id": "8d369b6e-113a-4640-9e63-dc29957fc86a"
}
},
"order": {
"order_id": "testapi-0003",
"currency": "MXN",
"items": [
{
"id": "216",
"name": "10 Cellphones",
"description": "",
"options": "string option",
"total_amount": {
"original_amount": 2000,
"amount": 2000,
"currency": "MXN",
"currency_symbol": "$"
},
"unit_price": {
"amount": 200,
"currency": "MXN",
"currency_symbol": "$"
},
"tax_amount": {
"amount": 0,
"currency": "MXN",
"currency_symbol": "$"
},
"quantity": 1,
"uom": "string",
"upc": "string",
"sku": "",
"isbn": "",
"brand": "",
"manufacturer": "",
"category": "",
"color": "",
"size": "",
"weight": {
"amount": 0,
"unit": "kg"
},
"image_url": "https://images-staging.getduna.com/95463fb5-6279-4ec3-8ff9-fe07aacd2142/db5b698c57654116_domicilio_216_750x750_1662162887.png?d=200x200&format=webp",
"details_url": "",
"type": "physcal",
"taxable": True
}
],
"sub_total": 2000,
"total_amount": 2000,
"store_code": "all",
"billing_address": {
"address1": "presa angostura 36PH",
"address2": "",
"address_type": "home",
"city": "CDMX",
"country_code": "MX",
"email": "foo@bar.com",
"first_name": "efren",
"identity_document": "162915134",
"is_default": True,
"last_name": "garcia",
"phone": "+525222222222",
"state_code": "MX",
"state_name": "miguel hidalgo",
"zipcode": "11500"
}
}
},
)
response.raise_for_status()
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.deuna.io/v2/merchants/orders/purchase",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"x-api-key: YOUR_PRIVATE_API_KEY",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"payer_info" => [
"email" => "foo@bar.com"
],
"payment_source" => [
"method_type" => "credit_card",
"card_info" => [
"card_id" => "8d369b6e-113a-4640-9e63-dc29957fc86a"
]
],
"order" => [
"order_id" => "testapi-0003",
"currency" => "MXN",
"items" => [
[
"id" => "216",
"name" => "10 Cellphones",
"description" => "",
"options" => "string option",
"total_amount" => [
"original_amount" => 2000,
"amount" => 2000,
"currency" => "MXN",
"currency_symbol" => "$"
],
"unit_price" => [
"amount" => 200,
"currency" => "MXN",
"currency_symbol" => "$"
],
"tax_amount" => [
"amount" => 0,
"currency" => "MXN",
"currency_symbol" => "$"
],
"quantity" => 1,
"uom" => "string",
"upc" => "string",
"sku" => "",
"isbn" => "",
"brand" => "",
"manufacturer" => "",
"category" => "",
"color" => "",
"size" => "",
"weight" => [
"amount" => 0,
"unit" => "kg"
],
"image_url" => "https://images-staging.getduna.com/95463fb5-6279-4ec3-8ff9-fe07aacd2142/db5b698c57654116_domicilio_216_750x750_1662162887.png?d=200x200&format=webp",
"details_url" => "",
"type" => "physcal",
"taxable" => true
]
],
"sub_total" => 2000,
"total_amount" => 2000,
"store_code" => "all",
"billing_address" => [
"address1" => "presa angostura 36PH",
"address2" => "",
"address_type" => "home",
"city" => "CDMX",
"country_code" => "MX",
"email" => "foo@bar.com",
"first_name" => "efren",
"identity_document" => "162915134",
"is_default" => true,
"last_name" => "garcia",
"phone" => "+525222222222",
"state_code" => "MX",
"state_name" => "miguel hidalgo",
"zipcode" => "11500"
]
]
])
]);
$response = curl_exec($curl);
curl_close($curl);import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.sandbox.deuna.io/v2/merchants/orders/purchase"))
.header("x-api-key", "YOUR_PRIVATE_API_KEY")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"payer_info\": {\n \"email\": \"foo@bar.com\"\n },\n \"payment_source\": {\n \"method_type\": \"credit_card\",\n \"card_info\": {\n \"card_id\": \"8d369b6e-113a-4640-9e63-dc29957fc86a\"\n }\n },\n \"order\": {\n \"order_id\": \"testapi-0003\",\n \"currency\": \"MXN\",\n \"items\": [\n {\n \"id\": \"216\",\n \"name\": \"10 Cellphones\",\n \"description\": \"\",\n \"options\": \"string option\",\n \"total_amount\": {\n \"original_amount\": 2000,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"currency_symbol\": \"$\"\n },\n \"unit_price\": {\n \"amount\": 200,\n \"currency\": \"MXN\",\n \"currency_symbol\": \"$\"\n },\n \"tax_amount\": {\n \"amount\": 0,\n \"currency\": \"MXN\",\n \"currency_symbol\": \"$\"\n },\n \"quantity\": 1,\n \"uom\": \"string\",\n \"upc\": \"string\",\n \"sku\": \"\",\n \"isbn\": \"\",\n \"brand\": \"\",\n \"manufacturer\": \"\",\n \"category\": \"\",\n \"color\": \"\",\n \"size\": \"\",\n \"weight\": {\n \"amount\": 0,\n \"unit\": \"kg\"\n },\n \"image_url\": \"https://images-staging.getduna.com/95463fb5-6279-4ec3-8ff9-fe07aacd2142/db5b698c57654116_domicilio_216_750x750_1662162887.png?d=200x200&format=webp\",\n \"details_url\": \"\",\n \"type\": \"physcal\",\n \"taxable\": true\n }\n ],\n \"sub_total\": 2000,\n \"total_amount\": 2000,\n \"store_code\": \"all\",\n \"billing_address\": {\n \"address1\": \"presa angostura 36PH\",\n \"address2\": \"\",\n \"address_type\": \"home\",\n \"city\": \"CDMX\",\n \"country_code\": \"MX\",\n \"email\": \"foo@bar.com\",\n \"first_name\": \"efren\",\n \"identity_document\": \"162915134\",\n \"is_default\": true,\n \"last_name\": \"garcia\",\n \"phone\": \"+525222222222\",\n \"state_code\": \"MX\",\n \"state_name\": \"miguel hidalgo\",\n \"zipcode\": \"11500\"\n }\n }\n}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request, HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
request, err := http.NewRequest("POST", "https://api.sandbox.deuna.io/v2/merchants/orders/purchase", strings.NewReader("{\n \"payer_info\": {\n \"email\": \"foo@bar.com\"\n },\n \"payment_source\": {\n \"method_type\": \"credit_card\",\n \"card_info\": {\n \"card_id\": \"8d369b6e-113a-4640-9e63-dc29957fc86a\"\n }\n },\n \"order\": {\n \"order_id\": \"testapi-0003\",\n \"currency\": \"MXN\",\n \"items\": [\n {\n \"id\": \"216\",\n \"name\": \"10 Cellphones\",\n \"description\": \"\",\n \"options\": \"string option\",\n \"total_amount\": {\n \"original_amount\": 2000,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"currency_symbol\": \"$\"\n },\n \"unit_price\": {\n \"amount\": 200,\n \"currency\": \"MXN\",\n \"currency_symbol\": \"$\"\n },\n \"tax_amount\": {\n \"amount\": 0,\n \"currency\": \"MXN\",\n \"currency_symbol\": \"$\"\n },\n \"quantity\": 1,\n \"uom\": \"string\",\n \"upc\": \"string\",\n \"sku\": \"\",\n \"isbn\": \"\",\n \"brand\": \"\",\n \"manufacturer\": \"\",\n \"category\": \"\",\n \"color\": \"\",\n \"size\": \"\",\n \"weight\": {\n \"amount\": 0,\n \"unit\": \"kg\"\n },\n \"image_url\": \"https://images-staging.getduna.com/95463fb5-6279-4ec3-8ff9-fe07aacd2142/db5b698c57654116_domicilio_216_750x750_1662162887.png?d=200x200&format=webp\",\n \"details_url\": \"\",\n \"type\": \"physcal\",\n \"taxable\": true\n }\n ],\n \"sub_total\": 2000,\n \"total_amount\": 2000,\n \"store_code\": \"all\",\n \"billing_address\": {\n \"address1\": \"presa angostura 36PH\",\n \"address2\": \"\",\n \"address_type\": \"home\",\n \"city\": \"CDMX\",\n \"country_code\": \"MX\",\n \"email\": \"foo@bar.com\",\n \"first_name\": \"efren\",\n \"identity_document\": \"162915134\",\n \"is_default\": true,\n \"last_name\": \"garcia\",\n \"phone\": \"+525222222222\",\n \"state_code\": \"MX\",\n \"state_name\": \"miguel hidalgo\",\n \"zipcode\": \"11500\"\n }\n }\n}"))
if err != nil { panic(err) }
request.Header.Set("x-api-key", "YOUR_PRIVATE_API_KEY")
request.Header.Set("Content-Type", "application/json")
response, err := http.DefaultClient.Do(request)
if err != nil { panic(err) }
defer response.Body.Close()
body, _ := io.ReadAll(response.Body)
fmt.Println(string(body))
}PHP
$curl = curl_init();
$requestBody = json_encode(array(
"payer_info" => array(
"email" => "foo@bar.com"
),
"payment_source" => array(
"method_type" => "credit_card",
"card_info" => array(
"card_id" => "8d369b6e-113a-4640-9e63-dc29957fc86a"
)
),
// Aquí puedes continuar añadiendo el resto del cuerpo de la solicitud
"order" => array(
"order_id" => "testapi-0003",
"currency" => "MXN",
"items" => array(
// Aquí van los detalles de los items
),
// Continúa con el resto de los detalles del pedido
)
));
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.sandbox.deuna.io/v2/merchants/orders/purchase",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $requestBody, // Aquí se utiliza la variable
CURLOPT_HTTPHEADER => array(
"x-api-key: YOUR_PRIVATE_API_KEY", // Asegúrate de reemplazar con tu API key real
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}Ruby
require 'uri'
require 'net/http'
require 'json'
url = URI("https://api.sandbox.deuna.io/v2/merchants/orders/purchase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request_body = {
payer_info: {
email: "foo@bar.com"
},
payment_source: {
method_type: "credit_card",
card_info: {
card_id: "8d369b6e-113a-4640-9e63-dc29957fc86a"
}
}
# ... Agrega aquí el resto del cuerpo de la solicitud
}.to_json
request = Net::HTTP::Post.new(url)
request["x-api-key"] = "YOUR_PRIVATE_API_KEY" # Reemplaza con tu API key
request["Content-Type"] = "application/json"
request.body = request_body
response = http.request(request)
puts response.read_bodyJava
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import org.json.JSONObject;
public class Main {
public static void main(String[] args) {
HttpClient client = HttpClient.newHttpClient();
JSONObject requestBody = new JSONObject()
.put("payer_info", new JSONObject().put("email", "foo@bar.com"))
.put("payment_source", new JSONObject()
.put("method_type", "credit_card")
.put("card_info", new JSONObject().put("card_id", "8d369b6e-113a-4640-9e63-dc29957fc86a")))
// ... Agrega aquí el resto del cuerpo de la solicitud
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.sandbox.deuna.io/v2/merchants/orders/purchase"))
.header("x-api-key", "YOUR_PRIVATE_API_KEY") // Reemplaza con tu API key
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody.toString()))
.build();
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(System.out::println)
.join();
}
}デモ
Payment Vaultを統合した後、体験は以下のデモと類似します。