Refund API call process returning "cannot exceed sales cap"

Refund API call process returning "cannot exceed sales cap"

eRegisterPro
Shopify Partner
4 0 3

We've been using a process to refund payments through the API with no problem until recently.  We do not include line item information as it is not necessary, and not required.

 

An example of something we're sending looks like this:

 

{
"refund": {
"currency": "USD",
"notify": true,
"transactions": [{
"parent_id": 6094289207491,
"amount": 149.95,
"kind": "refund",
"gateway": "merchant_ware"
}]
}
}

 

Response is:

 

{"errors":{"base":["cannot exceed sales cap"]}}

 

The original charge was for $219.90, so I'm not refunding more than was charged.

I should note that I've tried Cayan as the gateway as well, both return the same response.

I am able to process the refund through the web portal - again - without specifying line items; just keying in the refund and it works.  So the same should be possible (as it used to be) with this API

 

 

 

 

Replies 5 (5)

ShopifyDevSup
Shopify Staff
1453 238 508

Hey @eRegisterPro 

 

A refund needs to be done with the same gateway that captured the money, and if this is a multi currency order then you should also check to make sure that the presentment price was also USD.

 

Have you queried the parent transaction to confirm the amount showing there, or tried calculating a refund to see what the response is in REST?

Our GraphQL Admin API also has several useful fields for assessing the state and potential refundable values from the OrderTransaction object.

 

query ($id: ID!) {
node(id: $id) {
 ... on OrderTransaction {
  id
  amountSet {
   presentmentMoney {
    amount
    currencyCode
   }
  }
  status
  gateway
  totalUnsettledSet {
   presentmentMoney {
    amount
    currencyCode
   }
  }
  maximumRefundableV2 {
   amount
   currencyCode
  }
 }
 __typename
}
}


 

Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

eRegisterPro
Shopify Partner
4 0 3

I'm using the transaction resource here to see what payments were captured, the gateway name, the amount and the currency

 

https://shopify.dev/docs/api/admin-rest/2023-04/resources/transaction#get-orders-order-id-transactio...

 

See what's returned for this particular transaction below.  Note what I've highlighted in bold.  You'll not only see in this JSON the details of the original capture, but also the details surrounding my failed refund attempt (showing the same gateway and currency and a lesser amount than originally charged)

 

 

 

 

 

{

               "transactions": [{

                              "id": 6094289207491,

                              "order_id": 5093037244611,

                              "kind": "authorization",

                              "gateway": "merchant_ware",

                              "status": "success",

                              "message": "APPROVED",

                              "created_at": "2023-03-12T11:16:17-04:00",

                              "test": false,

                              "authorization": "4903707219;25650378",

                              "location_id": null,

                              "user_id": null,

                              "parent_id": null,

                              "processed_at": "2023-03-12T11:16:17-04:00",

                              "device_id": null,

                              "error_code": null,

                              "source_name": "6074371",

                              "payment_details": {

                                             "credit_card_bin": "517805",

                                             "avs_result_code": "Y",

                                             "cvv_result_code": "M",

                                             "credit_card_number": "•••• •••• •••• 9385",

                                             "credit_card_company": "Mastercard",

                                             "buyer_action_info": null,

                                             "credit_card_name": "Charity Latham",

                                             "credit_card_wallet": null,

                                             "credit_card_expiration_month": 6,

                                             "credit_card_expiration_year": 2027

                              },

                              "receipt": {

                                             "ReferenceID": "4903707219",

                                             "OrderNumber": "25650378",

                                             "TXDate": "3\/12\/2023 3:16:18 PM",

                                             "ApprovalStatus": "APPROVED",

                                             "AuthCode": "08564B",

                                             "CardHolder": "Charity Latham",

                                             "Amount": "219.90",

                                             "Type": "5",

                                             "CardNumber": "************9385",

                                             "CardType": "3",

                                             "AVSResponse": "Y",

                                             "CVResponse": "M",

                                             "POSEntryType": "1",

                                             "status": "APPROVED",

                                             "success": true,

                                             "message": "APPROVED"

                              },

                              "amount": "219.90",

                              "currency": "USD",

                              "payment_id": "c25650378277059.1",

                              "admin_graphql_api_id": "gid:\/\/shopify\/OrderTransaction\/6094289207491"

               }, {

                              "id": 6096043344067,

                              "order_id": 5093037244611,

                              "kind": "capture",

                              "gateway": "merchant_ware",

                              "status": "success",

                              "message": "APPROVED",

                              "created_at": "2023-03-13T14:35:48-04:00",

                              "test": false,

                              "authorization": "4905458219;25650378",

                              "location_id": null,

                              "user_id": null,

                              "parent_id": 6094289207491,

                              "processed_at": "2023-03-13T14:35:48-04:00",

                              "device_id": null,

                              "error_code": null,

                              "source_name": "5073231",

                              "payment_details": {

                                             "credit_card_bin": "517805",

                                             "avs_result_code": "Y",

                                             "cvv_result_code": "M",

                                             "credit_card_number": "•••• •••• •••• 9385",

                                             "credit_card_company": "Mastercard",

                                             "buyer_action_info": null,

                                             "credit_card_name": "Charity Latham",

                                             "credit_card_wallet": null,

                                             "credit_card_expiration_month": 6,

                                             "credit_card_expiration_year": 2027

                              },

                              "receipt": {

                                             "ReferenceID": "4905458219",

                                             "OrderNumber": "25650378",

                                             "TXDate": "3\/13\/2023 6:35:49 PM",

                                             "ApprovalStatus": "APPROVED",

                                             "AuthCode": "08564B",

                                             "CardHolder": null,

                                             "Amount": "219.90",

                                             "Type": "9",

                                             "CardNumber": null,

                                             "CardType": "0",

                                             "AVSResponse": null,

                                             "CVResponse": null,

                                             "POSEntryType": "3",

                                             "status": "APPROVED",

                                             "success": true,

                                             "message": "APPROVED"

                              },

                              "amount": "219.90",

                              "currency": "USD",

                              "payment_id": "c25650378277059.2",

                              "admin_graphql_api_id": "gid:\/\/shopify\/OrderTransaction\/6096043344067"

               }, {

                              "id": 6139607974083,

                              "order_id": 5093037244611,

                              "kind": "refund",

                              "gateway": "merchant_ware",

                              "status": "failure",

                              "message": "cannot exceed sales cap",

                              "created_at": "2023-04-10T15:16:59-04:00",

                              "test": false,

                              "authorization": null,

                              "location_id": null,

                              "user_id": null,

                              "parent_id": 6094289207491,

                              "processed_at": "2023-04-10T15:16:59-04:00",

                              "device_id": null,

                              "error_code": null,

                              "source_name": "5073231",

                              "payment_details": {

                                             "credit_card_bin": "517805",

                                             "avs_result_code": "Y",

                                             "cvv_result_code": "M",

                                             "credit_card_number": "•••• •••• •••• 9385",

                                             "credit_card_company": "Mastercard",

                                             "buyer_action_info": null,

                                             "credit_card_name": "Charity Latham",

                                             "credit_card_wallet": null,

                                             "credit_card_expiration_month": 6,

                                             "credit_card_expiration_year": 2027

                              },

                              "receipt": {

                                             "ReferenceID": "4953292387",

                                             "OrderNumber": "25650378",

                                             "TXDate": "4\/10\/2023 7:16:59 PM",

                                             "ApprovalStatus": "FAILED;1113;cannot exceed sales cap",

                                             "AuthCode": "Cannot_Exceed_Sales_Cap",

                                             "CardHolder": null,

                                             "Amount": "149.95",

                                             "Type": "2",

                                             "CardNumber": null,

                                             "CardType": "3",

                                             "AVSResponse": null,

                                             "CVResponse": null,

                                             "POSEntryType": "1",

                                             "status": "FAILED",

                                             "success": false,

                                             "message": "cannot exceed sales cap",

                                             "failure_code": "1113"

                              },

                              "amount": "149.95",

                              "currency": "USD",

                              "payment_id": "c25650378277059.3",

                              "admin_graphql_api_id": "gid:\/\/shopify\/OrderTransaction\/6139607974083"

               }, {

                              "id": 6139638350019,

                              "order_id": 5093037244611,

                              "kind": "refund",

                              "gateway": "merchant_ware",

                              "status": "failure",

                              "message": "cannot exceed sales cap",

                              "created_at": "2023-04-10T15:46:48-04:00",

                              "test": false,

                              "authorization": null,

                              "location_id": null,

                              "user_id": null,

                              "parent_id": 6094289207491,

                              "processed_at": "2023-04-10T15:46:48-04:00",

                              "device_id": null,

                              "error_code": null,

                              "source_name": "5073231",

                              "payment_details": {

                                             "credit_card_bin": "517805",

                                             "avs_result_code": "Y",

                                             "cvv_result_code": "M",

                                             "credit_card_number": "•••• •••• •••• 9385",

                                             "credit_card_company": "Mastercard",

                                             "buyer_action_info": null,

                                             "credit_card_name": "Charity Latham",

                                             "credit_card_wallet": null,

                                             "credit_card_expiration_month": 6,

                                             "credit_card_expiration_year": 2027

                              },

                              "receipt": {

                                             "ReferenceID": "4953362889",

                                             "OrderNumber": "25650378",

                                             "TXDate": "4\/10\/2023 7:46:49 PM",

                                             "ApprovalStatus": "FAILED;1113;cannot exceed sales cap",

                                             "AuthCode": "Cannot_Exceed_Sales_Cap",

                                             "CardHolder": null,

                                             "Amount": "149.95",

                                             "Type": "2",

                                             "CardNumber": null,

                                             "CardType": "3",

                                             "AVSResponse": null,

                                             "CVResponse": null,

                                             "POSEntryType": "1",

                                             "status": "FAILED",

                                             "success": false,

                                             "message": "cannot exceed sales cap",

                                             "failure_code": "1113"

                              },

                              "amount": "149.95",

                              "currency": "USD",

                              "payment_id": "c25650378277059.4",

                              "admin_graphql_api_id": "gid:\/\/shopify\/OrderTransaction\/6139638350019"

               }, {

                              "id": 6139657814211,

                              "order_id": 5093037244611,

                              "kind": "refund",

                              "gateway": "merchant_ware",

                              "status": "failure",

                              "message": "cannot exceed sales cap",

                              "created_at": "2023-04-10T16:06:29-04:00",

                              "test": false,

                              "authorization": null,

                              "location_id": null,

                              "user_id": null,

                              "parent_id": 6094289207491,

                              "processed_at": "2023-04-10T16:06:29-04:00",

                              "device_id": null,

                              "error_code": null,

                              "source_name": "5073231",

                              "payment_details": {

                                             "credit_card_bin": "517805",

                                             "avs_result_code": "Y",

                                             "cvv_result_code": "M",

                                             "credit_card_number": "•••• •••• •••• 9385",

                                             "credit_card_company": "Mastercard",

                                             "buyer_action_info": null,

                                             "credit_card_name": "Charity Latham",

                                             "credit_card_wallet": null,

                                             "credit_card_expiration_month": 6,

                                             "credit_card_expiration_year": 2027

                              },

                              "receipt": {

                                             "ReferenceID": "4953411075",

                                             "OrderNumber": "25650378",

                                             "TXDate": "4\/10\/2023 8:06:29 PM",

                                             "ApprovalStatus": "FAILED;1113;cannot exceed sales cap",

                                             "AuthCode": "Cannot_Exceed_Sales_Cap",

                                             "CardHolder": null,

                                             "Amount": "149.95",

                                             "Type": "2",

                                             "CardNumber": null,

                                             "CardType": "3",

                                             "AVSResponse": null,

                                             "CVResponse": null,

                                             "POSEntryType": "1",

                                             "status": "FAILED",

                                             "success": false,

                                             "message": "cannot exceed sales cap",

                                             "failure_code": "1113"

                              },

                              "amount": "149.95",

                              "currency": "USD",

                              "payment_id": "c25650378277059.5",

                              "admin_graphql_api_id": "gid:\/\/shopify\/OrderTransaction\/6139657814211"

               }, {

                              "id": 6139663352003,

                              "order_id": 5093037244611,

                              "kind": "refund",

                              "gateway": "merchant_ware",

                              "status": "failure",

                              "message": "cannot exceed sales cap",

                              "created_at": "2023-04-10T16:11:06-04:00",

                              "test": false,

                              "authorization": null,

                              "location_id": null,

                              "user_id": null,

                              "parent_id": 6094289207491,

                              "processed_at": "2023-04-10T16:11:06-04:00",

                              "device_id": null,

                              "error_code": null,

                              "source_name": "5073231",

                              "payment_details": {

                                             "credit_card_bin": "517805",

                                             "avs_result_code": "Y",

                                             "cvv_result_code": "M",

                                             "credit_card_number": "•••• •••• •••• 9385",

                                             "credit_card_company": "Mastercard",

                                             "buyer_action_info": null,

                                             "credit_card_name": "Charity Latham",

                                             "credit_card_wallet": null,

                                             "credit_card_expiration_month": 6,

                                             "credit_card_expiration_year": 2027

                              },

                              "receipt": {

                                             "ReferenceID": "4953422499",

                                             "OrderNumber": "25650378",

                                             "TXDate": "4\/10\/2023 8:11:06 PM",

                                             "ApprovalStatus": "FAILED;1113;cannot exceed sales cap",

                                             "AuthCode": "Cannot_Exceed_Sales_Cap",

                                             "CardHolder": null,

                                             "Amount": "149.95",

                                             "Type": "2",

                                             "CardNumber": null,

                                             "CardType": "3",

                                             "AVSResponse": null,

                                             "CVResponse": null,

                                             "POSEntryType": "1",

                                             "status": "FAILED",

                                             "success": false,

                                             "message": "cannot exceed sales cap",

                                             "failure_code": "1113"

                              },

                              "amount": "149.95",

                              "currency": "USD",

                              "payment_id": "c25650378277059.6",

                              "admin_graphql_api_id": "gid:\/\/shopify\/OrderTransaction\/6139663352003"

               }, {

                              "id": 6139675738307,

                              "order_id": 5093037244611,

                              "kind": "refund",

                              "gateway": "merchant_ware",

                              "status": "success",

                              "message": "APPROVED",

                              "created_at": "2023-04-10T16:20:57-04:00",

                              "test": false,

                              "authorization": "4953446420;25650378",

                              "location_id": null,

                              "user_id": 72256585923,

                              "parent_id": 6096043344067,

                              "processed_at": "2023-04-10T16:20:57-04:00",

                              "device_id": null,

                              "error_code": null,

                              "source_name": "1830279",

                              "payment_details": {

                                             "credit_card_bin": "517805",

                                             "avs_result_code": "Y",

                                             "cvv_result_code": "M",

                                             "credit_card_number": "•••• •••• •••• 9385",

                                             "credit_card_company": "Mastercard",

                                             "buyer_action_info": null,

                                             "credit_card_name": "Charity Latham",

                                             "credit_card_wallet": null,

                                             "credit_card_expiration_month": 6,

                                             "credit_card_expiration_year": 2027

                              },

                              "receipt": {

                                             "ReferenceID": "4953446420",

                                             "OrderNumber": "25650378",

                                             "TXDate": "4\/10\/2023 8:20:59 PM",

                                             "ApprovalStatus": "APPROVED",

                                             "AuthCode": "017668",

                                             "CardHolder": null,

                                             "Amount": "149.95",

                                             "Type": "2",

                                             "CardNumber": null,

                                             "CardType": "3",

                                             "AVSResponse": null,

                                             "CVResponse": null,

                                             "POSEntryType": "1",

                                             "status": "APPROVED",

                                             "success": true,

                                             "message": "APPROVED"

                              },

                              "amount": "149.95",

                              "currency": "USD",

                              "payment_id": "c25650378277059.7",

                              "admin_graphql_api_id": "gid:\/\/shopify\/OrderTransaction\/6139675738307"

               }]

}

eRegisterPro
Shopify Partner
4 0 3

As per my prior post, this doesn't appear to be failing on account of the gateway being incorrect or the amount exceeding the original charge.  Any further thoughts?

ShopifyDevSup
Shopify Staff
1453 238 508

Hi @eRegisterPro,

 

Thanks for providing that additional detail. The transaction.message field is described in [the docs] as: "A string generated by the payment provider with additional information about why the transaction succeeded or failed."

 

So for help with the message of 'cannot exceed sales cap' you would need to reach out to the payment provider directly.

 

Hope you have a great day

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

eRegisterPro
Shopify Partner
4 0 3

I've shared this same information with the payment processor.  The reason that doesn't quite make sense as an explanation is that I was able to successfully perform the partial refund on the Shopify admin portal.  This error response was only occurring when the refund was requested via the API.  Same refund amount, same gateway, etc..

 

 

eRegisterPro_0-1682370510739.png