可以允許adyen保留信用卡詳細信息並根據令牌或客戶ID而不是信用卡信息向客戶付款。 我檢查了adyen標記化方法,我找不到任何標記化方法的api文檔(類似於條紋支付)。Adyen支付:節省卡令牌並從令牌以後付款
任何人請給我推薦。
可以允許adyen保留信用卡詳細信息並根據令牌或客戶ID而不是信用卡信息向客戶付款。 我檢查了adyen標記化方法,我找不到任何標記化方法的api文檔(類似於條紋支付)。Adyen支付:節省卡令牌並從令牌以後付款
任何人請給我推薦。
看來您正在尋找經常性付款。如果是的話,你可能會想這樣做,路過的信用卡資料通過客戶端加密:
curl -u "[email protected]":"YourWsPassword" \
-H "Content-Type: application/json" \
-X POST --data \
'{
"additionalData": {
"card.encrypted.json":"adyenjs_0_1_4p1$..."
},
"amount" : {
"value" : 20000,
"currency" : "EUR"
},
"reference" : "Your Reference Here",
"merchantAccount" : "TestMerchant",
"shopperEmail" : "[email protected]",
"shopperReference" : "Simon Hopper",
"recurring" : {
"contract" : "RECURRING"
}
}' \
https://pal-test.adyen.com/pal/servlet/Payment/v18/authorise
要在以後使用這些細節,你應該只提交這樣的數據:
curl -u "[email protected]":"YourWsPassword" \
-H "Content-Type: application/json" \
-X POST --data \
'{
"amount" : {
"value" : 20000,
"currency" : "EUR"
},
"reference" : "Your Reference Here",
"merchantAccount" : "TestMerchant",
"shopperEmail" : "[email protected]",
"shopperReference" : "Simon Hopper",
"selectedRecurringDetailReference" : "LATEST",
"shopperInteraction" : "ContAuth",
"recurring" : {
"contract" : "RECURRING"
}
}' \
https://pal-test.adyen.com/pal/servlet/Payment/v18/authorise
要擴大uselight的答案,你可以肯定地標記卡的細節。
Adyen使用購物者概念,充當存儲桶來存儲已保存的詳細信息。此shopperReference
由您定義,任何支持重複收費的支付方法都可以根據此ID存儲。
要存儲信用卡,首先需要使用CSE(客戶端加密)接受卡詳細信息。這將在客戶端的瀏覽器上提交給你的服務器之前加密卡片的詳細信息,並允許你完全控制輸入字段的外觀。下面是一個例子形式:
<script type="text/javascript" src="https://test.adyen.com/hpp/cse/js/adyen.encrypt.js"></script>
<form method="POST" action="payment-request-handler.php" id="adyen-encrypted-form">
<input type="text" size="20" data-encrypted-name="number"/>
<input type="text" size="20" data-encrypted-name="holderName"/>
<input type="text" size="2" data-encrypted-name="expiryMonth"/>
<input type="text" size="4" data-encrypted-name="expiryYear"/>
<input type="text" size="4" data-encrypted-name="cvc"/>
<input type="hidden" value="[generate this timestamp server side]" data-encrypted-name="generationtime"/>
<input type="submit" value="Pay"/>
</form>
<script>
// The form element to encrypt.
var form = document.getElementById('adyen-encrypted-form');
// See https://github.com/Adyen/CSE-JS/blob/master/Options.md for details on the options to use.
var options = {};
// Bind encryption options to the form.
adyen.createEncryptedForm(form, options);
</script>
所有與data-encrypted-name
屬性字段將被刪除,並用一個單一的adyen-encrypted-data
代替。從這裏,你的php服務器可以使用我們提供的php api library來執行授權調用。要稍後保存詳細信息,請包括shopperEmail
,shopperReference
(這是您爲購物者指定的ID)和recurring.contract
。經常性合約價值通常將爲RECURRING
。請務必在稍後存儲pspReference,因爲這將用於匹配保存的詳細信息。
$client = new \Adyen\Client();
$client->setApplicationName("Adyen PHP Api Library Example");
$client->setUsername("[YOUR USERNAME]");
$client->setPassword("[YOUR PASSWORD]");
$client->setEnvironment(\Adyen\Environment::TEST);
$service = new Service\Payment($client);
$json = '{
"amount": {
"value": 999,
"currency": "USD"
},
"reference": "payment-test",
"merchantAccount": "[YOUR MERCHANT ACCOUNT]",
"additionalData": {
"card.encrypted.json": ' . $_POST['adyen-encrypted-data'] . '
},
"shopperEmail" : "[email protected]",
"shopperReference" : "shopperref123456",
"recurring" : {
"contract" : "RECURRING"
}
}'
$params = json_decode($json, true);
$result = $service->authorise($params);
$pspReference = $result.pspReference;
後收到的授權結果,則可以執行shopperReference
的查找來獲得用於經常性通過listRecurringDetails
通話費用令牌。
$service = new Service\Recurring($client);
$recurring = array('contract' => \Adyen\Contract::RECURRING);
$params = array('merchantAccount' => '[Your Merchant Account]',
'recurring' => $recurring,
'shopperReference' => 'shopperref123456'
);
$result = $service->listRecurringDetails($params);
$recurringToken = '';
foreach($result['details'] as $detail) {
if($detail['RecurringDetail']['firstPspReference'] == $pspReference) {
$recurringToken = $detail['RecurringDetail']['recurringDetailReference'];
}
}
您使用此recurringDetailReference
執行未來費用。
$service = new Service\Payment($client);
$json = '{
"amount": {
"value": 999,
"currency": "USD"
},
"reference": "recurring-test",
"merchantAccount": "[YOUR MERCHANT ACCOUNT]",
"selectedRecurringDetailReference":' . $recurringToken . '
"shopperEmail" : "[email protected]",
"shopperReference" : "shopperref123456",
"recurring" : {
"contract" : "RECURRING"
}
}'
$params = json_decode($json, true);
$result = $service->authorise($params);
希望這會有所幫助。檢查出Recurring Documentation以及。