3

When authorizing an order on Amazon Payments, the authorization status may come back as Declined with InvalidPaymentMethod as the reason, if the customer has to login to Amazon Payments and change payment method.

How to force Amazon to reproduce this InvalidPaymentMethod case for testing?

4

1 回答 1

4

哦,RTM……我在集成指南中找到了答案。当您拨打 Authorize 电话时,您必须指定 SellerAuthorizationNote:

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

在这里为集成此付款方式的开发人员留下问题。

这是最终方法的样子:

/**
 * @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's just for sandbox testing
        'SellerAuthorizationNote'  => json_encode(['SandboxSimulation' => [
            'State'                         => 'Declined',
            'ReasonCode'                    => 'InvalidPaymentMethod',
            'PaymentMethodUpdateTimeInMins' => 5
        ]])
    ]);
}
于 2015-04-22T10:16:21.460 回答