How do I check for Amazon Payments authorization rejection?

When authorizing an order on Amazon Payments, the authorization status may return as Declined

c InvalidPaymentMethod

as a reason if a customer needs to sign in to Amazon Payments and change their payment method.

How do I get Amazon to reproduce this case InvalidPaymentMethod

for testing?

+3


source to share


1 answer


Oh, RTM ... I found the answer in the Integration Guide . When you log in, you need to specify the SellerAuthorizationNote:

{"SandboxSimulation": {
     "State":"Declined",
     "ReasonCode":"InvalidPaymentMethod",
     "PaymentMethodUpdateTimeInMins":5}}

      

The question is for developers to integrate this payment method.



This is what the last method looks like:

/**
 * @param string $orderReferenceId
 * @param string $authorizationReferenceId
 * @param float  $amount
 * @param string $currencyCode
 * @return \OffAmazonPaymentsService_Model_AuthorizeResponse
 */
private function authorizeOrder($orderReferenceId, $authorizationReferenceId, $amount, $currencyCode)
{
    return $this->getClient()->authorize([
        'SellerId'                 => $this->serviceCrendentials['merchantId'],
        'AmazonOrderReferenceId'   => $orderReferenceId,
        'AuthorizationReferenceId' => $authorizationReferenceId,
        'AuthorizationAmount'      => [
            'Amount'               => $amount,
            'CurrencyCode'         => $currencyCode
        ],
        // Delete it, it just for sandbox testing
        'SellerAuthorizationNote'  => json_encode(['SandboxSimulation' => [
            'State'                         => 'Declined',
            'ReasonCode'                    => 'InvalidPaymentMethod',
            'PaymentMethodUpdateTimeInMins' => 5
        ]])
    ]);
}

      

+4


source







All Articles