Skip to main content
Answer

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

  • May 10, 2024
  • 5 replies
  • 66 views

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

5 replies

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • Answer
  • May 13, 2024

@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


Forum|alt.badge.img+2
  • Author
  • Semi-Pro I
  • May 13, 2024

@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


Dmitrii Naumov
Acumatica Moderator
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. 

 

 


Forum|alt.badge.img+2
  • Author
  • Semi-Pro I
  • May 13, 2024

@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?


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7

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