Skip to main content
Solved

REST API: how can I change a card for an existing payment?

  • May 10, 2024 10:11 PM UTC
  • 5 replies
  • 122 views
  • Translate All

Forum|alt.badge.img+2

I have a customer who made a payment using a credit and wants to change to a different card (different payment method already associated with his account).  How can I modify the payment to reflect this?  I tried the following PUT method URL in Postman:

https://sandbox.com/AcumaticaERP/entity/Default/22.200.001/Payment

Here’s the body I passed:

{

        "Type":{"value":"Payment"},

        "ReferenceNbr": { "value": "183610" },

        "PaymentMethod": {"value": "CC MASTCRD"},

        "NewCard": { "value": false },

        "CardAccountNbr": {"value": "Mastcrd:****-****-****-4203"}

}

I don’t get an error but, unfortunately, Postman just returns the existing Payment with no card change applied.

Best answer by Dmitrii Naumov

@bpgraves  for the CardAccountNbr field you need the “id” of the payment method. 

So it should look like that:

{
"id": "f6dfbed1-3611-ef11-8c5b-ee3e36cd4d36",
"CardAccountNbr": {
"value": 2365
},
"CashAccount": {
"value": "10600"
},
"PaymentMethod": {
"value": "CC"
},
"ProcessingCenterID": {
"value": "ACUPAY"
},
"ReferenceNbr": {
"value": "005098"
},
"Type": {
"value": "Payment"
}
}

And of course, the payment needs to be editable, e.g. not released

View original

5 replies

Dmitrii Naumov
Community Manager
Forum|alt.badge.img+7
  • Community Manager
  • Answer
  • May 13, 2024 3:12 PM UTC

@bpgraves  for the CardAccountNbr field you need the “id” of the payment method. 

So it should look like that:

{
"id": "f6dfbed1-3611-ef11-8c5b-ee3e36cd4d36",
"CardAccountNbr": {
"value": 2365
},
"CashAccount": {
"value": "10600"
},
"PaymentMethod": {
"value": "CC"
},
"ProcessingCenterID": {
"value": "ACUPAY"
},
"ReferenceNbr": {
"value": "005098"
},
"Type": {
"value": "Payment"
}
}

And of course, the payment needs to be editable, e.g. not released

Translate

Forum|alt.badge.img+2
  • Author
  • Semi-Pro III
  • May 13, 2024 5:14 PM UTC

@bpgraves  for the CardAccountNbr field you need the “id” of the payment method. 

So it should look like that:

{
"id": "f6dfbed1-3611-ef11-8c5b-ee3e36cd4d36",
"CardAccountNbr": {
"value": 2365
},
"CashAccount": {
"value": "10600"
},
"PaymentMethod": {
"value": "CC"
},
"ProcessingCenterID": {
"value": "ACUPAY"
},
"ReferenceNbr": {
"value": "005098"
},
"Type": {
"value": "Payment"
}
}

And of course, the payment needs to be editable, e.g. not released

I’m not sure what you mean by the “id” of the payment method.  Are you referring to the Payment ReferenceNbr?  If not, how to do I obtain this integer?  Also, the ProcessingCenterID is empty when I get the Payment using:

https://sandbox.com/AcumaticaERP/entity/Default/22.200.001/Payment/Payment/598089

Translate

Dmitrii Naumov
Community Manager
Forum|alt.badge.img+7

@bpgraves the ID is what you get in the InstanceID field from Get: {{sitename}}/entity/default/23.200.001/CustomerPaymentMethod

 

Unfortunately it’s not visible anywhere in UI. Not sure about the ProcessingCenterID though. Generally if you set the Payment Method and the CardNbr, the ProcessingCenter is going to be filled automatically. 

 

 

Translate

Forum|alt.badge.img+2
  • Author
  • Semi-Pro III
  • May 13, 2024 5:46 PM UTC

@bpgraves the ID is what you get in the InstanceID field from Get: {{sitename}}/entity/default/23.200.001/CustomerPaymentMethod

 

Unfortunately it’s not visible anywhere in UI. Not sure about the ProcessingCenterID though. Generally if you set the Payment Method and the CardNbr, the ProcessingCenter is going to be filled automatically. 

 

 

Thanks…almost there.  For the ProcessingCenterID, are you referring to the ProcCenterID from the CustomerPaymentMethod?

Translate

Dmitrii Naumov
Community Manager
Forum|alt.badge.img+7

@bpgraves yes, but normally you do not need to set it explicitly. 

Translate