.netsdkamazon-pay

The OrderReferenceId C01-9737628-XXXXXX is invalid


We're integrating our solution to AmazonPay.

I'm trying to "GetOrderReferenceDetails" using dotnet SDK but I'm getting this response: "The OrderReferenceId C01-9737628-XXXXXX is invalid".

I grabbed the AmazonOrderReferenceId like so:

//Front end
onOrderReferenceCreate: function (orderReference) {
            var id = orderReference.getAmazonOrderReferenceId();
}

which returns something like "C01-9737628-XXXXXX".

The environment is sandbox.

This is the code I'm using to get the detail on server side:

var getOrdDetailReq = new GetOrderReferenceDetailsRequest()
            .WithAccessToken(token)
            .WithAmazonOrderReferenceId(amznOrdRefId)
            .WithMerchantId(merchantId)
            .WithMWSAuthToken(mwsToken);


        var getOrdDetailRes = client.GetOrderReferenceDetails(getOrdDetailReq);

My intent is to accomplish an one time payment.

Am I missing something?


Solution

  • References starting with "C01-..." are billing agreements for recurring payments. To get an order reference you want to start a one time payment.

    To create an authorization based on a billing agreement, you have to use the AuthorizeOnBillingAgreement call (https://developer.amazon.com/docs/amazon-pay-api/authorizeonbillingagreement.html).