What is the Braintree payment method nonce?
The payment method nonce is a string returned by the client SDK to represent a payment method.
This string is a reference to the customer payment method details that were provided in your payment form and should be sent to your server where it can be used with the server SDKs to create a new transaction request.
Payment method nonces expire after 24 hours.
this.braintreeClient.tokenizeCard(cardInfo, function (error, nonce) {
if (error) {
self.isPaymentProcessing.reject(error);
return;
}
self.paymentMethodNonce(nonce);
if (self.show3dSecure) {
self.verify3DS();
return;
}
self.isPaymentProcessing.resolve();
});
/**
* Assign corresponding data
*
* @param \Magento\Framework\DataObject|mixed $data
* @return $this
* @throws LocalizedException
*/
public function assignData(\Magento\Framework\DataObject $data)
{
parent::assignData($data);
$infoInstance = $this->getInfoInstance();
if ($this->getConfigData('fraudprotection') > 0) {
$infoInstance->setAdditionalInformation('device_data', $data->getData('device_data'));
}
$infoInstance->setAdditionalInformation('cc_last4', $data->getData('cc_last4'));
$infoInstance->setAdditionalInformation('cc_token', $data->getCcToken());
$infoInstance->setAdditionalInformation('payment_method_nonce', $data->getPaymentMethodNonce());
$infoInstance->setAdditionalInformation('store_in_vault', $data->getStoreInVault());
return $this;
}
How is a payment method’s assignData()
used?
How does a payment information saving work when a registered customer places an order?
/**
* Authorizes specified amount
*
* @param InfoInterface $payment
* @param float $amount
* @param bool $capture
* @param string $token
* @return $this
* @throws LocalizedException
*/
protected function braintreeAuthorize(InfoInterface $payment, $amount, $capture, $token = null)
{
try {
$transactionParams = $this->populateAuthorizeRequest($payment, $token);
1. authorize
/**
* Authorizes specified amount
*
* @param InfoInterface $payment
* @param float $amount
* @return $this
* @throws LocalizedException
*/
public function authorize(InfoInterface $payment, $amount)
{
return $this->braintreeAuthorize($payment, $amount, false);
}
How is a payment method’s authorize()
used?
2. partialCapture
3. capture
How is a payment method’s capture()
used?