ChargePermission is not in a valid state to execute this operation

14 Views Asked by At

`After Call CompleteCheckoutsession() get ChargeId and ChargePermissionId the perform the Authorize (Create Charge) getting below error:'

`ChargePermission is not in a valid state to execute this operation'

var result = client.CompleteCheckoutSession(amazonCheckoutSessionId, request);
ChargePermissionResponse result1 = client.GetChargePermission(result .ChargePermissionId);
var request = new CreateChargeRequest(result1 .ChargePermissionId, Convert.ToDecimal(Total),currencyCode)
 {
     CaptureNow = false,
     CanHandlePendingAuthorization = true,
 };

 ChargeResponse chargeResponse = client.CreateCharge(request);

reasonCode:InvalidChargePermissionStatus
message:ChargePermission is not in a valid state to         
1

There are 1 best solutions below

0
marcus.kreusch On

CompleteCheckoutsession() does already create a Charge for the complete amount and you want to work with that one. This is also the reason why you cannot create a second one.

For your code the ChargeId should be in result.chargeId.

Please check at the bottom of this page for reference: https://developer.amazon.com/docs/amazon-pay-checkout/verify-and-complete-checkout.html