Skip to main content
Solved

REST API: how do I Record CC payment previously done in SOAP


Forum|alt.badge.img+2

Here’s what I’m doing now in SOAP to Record a CC payment:

            var pymtSchema = _context.AR302000GetSchema();
            _context.AR302000Clear();
            var commands = new List<Command>();
            try
            {
                _context.AR302000Clear();
                commands.Clear();
                commands.Add(new Value { Value = "Payment", LinkedCommand = pymtSchema.PaymentSummary.Type });
                commands.Add(new Value { Value = paymentRefNbr, LinkedCommand = pymtSchema.PaymentSummary.ReferenceNbr });
                commands.Add(new Value { Value = bt_transactiontoken, LinkedCommand = pymtSchema.PaymentSummary.PaymentRef });
                commands.Add(new Value { Value = bt_transactiontoken, LinkedCommand = pymtSchema.RecordCCPaymentCCPaymentData.PCTranNumber });
                commands.Add(new Value { Value = "OK", LinkedCommand = pymtSchema.PaymentSummary.ServiceCommands.DialogAnswer, Commit = true });
                commands.Add(pymtSchema.Actions.RecordCCPayment);

                var pymtResults = _context.AR302000Submit(commands.ToArray());
            }

 

How do I do this with the REST API?

Best answer by bpgraves

I was able to find a solution by extending the Payment web service endpoint and adding the RecordCCPayment action like this...

I was then able to call the following POST method in Postman:

https://sandbox.com/AcumaticaERP/entity/DefaultExtended/22.200.001/Payment/RecordCCPayment?$PCTranNumber=xxxxxxxx

{

    "entity": {

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

        "ReferenceNbr": {"value": "598034"},

        "PaymentRef": {"value": "xxxxxxxx"}

    },

    "parameters": {

        "PCTranNumber": {"value": "xxxxxxxx"}

    }

}

View original
Did this topic help you find an answer to your question?

8 replies

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6
  • Acumatica Moderator
  • 595 replies
  • May 13, 2024

Here is an example:
 

PUT: Default/23.200.001/Payment

{
    "CustomerID": {
        "value": "ABARTENDE"
    },
    "PaymentAmount": {
        "value": 123.0000
    },
    "PaymentMethod": {
        "value": "DEMOCC"
    },
    "CreditCardTransactionInfo": [
        {
            "TranNbr": {
                "value": "11eeebd4c8c9d10ea4d3b823"
            },
            "TranType": {
                "value": "AUT"
            },
            "NeedsValidation": {
                "value": true
            },
            "AuthNbr": {
                "value": "ebd4c8"
            }
        }
    ]
}

 


Forum|alt.badge.img+2
  • Author
  • Semi-Pro I
  • 61 replies
  • May 13, 2024
Dmitrii Naumov wrote:

Here is an example:
 

PUT: Default/23.200.001/Payment

{
    "CustomerID": {
        "value": "ABARTENDE"
    },
    "PaymentAmount": {
        "value": 123.0000
    },
    "PaymentMethod": {
        "value": "DEMOCC"
    },
    "CreditCardTransactionInfo": [
        {
            "TranNbr": {
                "value": "11eeebd4c8c9d10ea4d3b823"
            },
            "TranType": {
                "value": "AUT"
            },
            "NeedsValidation": {
                "value": true
            },
            "AuthNbr": {
                "value": "ebd4c8"
            }
        }
    ]
}

 

This looks like it creates a brand new payment.  I want to Record Card Payment (under Card Processing menu on AR302000 page) using an existing Payment ReferenceNbr and transaction number.  How do I include the ReferenceNbr without creating a brand new Payment?


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6
  • Acumatica Moderator
  • 595 replies
  • May 13, 2024

@bpgraves  you do it the same way, just add ID or ReferenceNbr and Type.

E.g.

 

PUT: Default/23.200.001/Payment

{
   "id": "671e3b2c-d87f-e411-beca-00b56d0561c2",
          "Type": {
            "value": "Payment"
        }, 
"ReferenceNbr": {
            "value": "002266"
        },
    "CreditCardTransactionInfo": [
        {
            "TranNbr": {
                "value": "11eeebd4c8c9d10ea4d3b823"
            },
            "TranType": {
                "value": "AUT"
            },
            "NeedsValidation": {
                "value": true
            },
            "AuthNbr": {
                "value": "ebd4c8"
            }
        }
    ]
}

 


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

Thank you.  Getting closer now.  I’m assuming the TranNbr is the PaymentRef but I’m not sure what the AuthNbr is.  If I don’t include it, I just get the same Payment returned.  I tried to locate it using this GET method URL but it just returns the Payment with an empty CreditCardTransactionInfo object:
https://sandbox.com/entity/Default/22.200.001/Payment/Payment/709958?$expand=CreditCardTransactionInfo


Forum|alt.badge.img+2
  • Author
  • Semi-Pro I
  • 61 replies
  • May 13, 2024
Dmitrii Naumov wrote:

@bpgraves  you do it the same way, just add ID or ReferenceNbr and Type.

E.g.

 

PUT: Default/23.200.001/Payment

{
   "id": "671e3b2c-d87f-e411-beca-00b56d0561c2",
          "Type": {
            "value": "Payment"
        }, 
"ReferenceNbr": {
            "value": "002266"
        },
    "CreditCardTransactionInfo": [
        {
            "TranNbr": {
                "value": "11eeebd4c8c9d10ea4d3b823"
            },
            "TranType": {
                "value": "AUT"
            },
            "NeedsValidation": {
                "value": true
            },
            "AuthNbr": {
                "value": "ebd4c8"
            }
        }
    ]
}

 

I’m assuming the TranNbr is the PaymentRef but I’m not sure what the AuthNbr is.  What needs to be in AuthNbr?  If I don’t include it, I just get the same Payment object returned.  I tried to locate it using this GET method URL but it just returns the Payment with an empty CreditCardTransactionInfo object:
https://sandbox.com/entity/Default/22.200.001/Payment/Payment/709958?$expand=CreditCardTransactionInfo


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2640 replies
  • July 1, 2024

Hi @bpgraves were you able to find a solution? Thank you!


Forum|alt.badge.img+2
  • Author
  • Semi-Pro I
  • 61 replies
  • Answer
  • August 21, 2024

I was able to find a solution by extending the Payment web service endpoint and adding the RecordCCPayment action like this...

I was then able to call the following POST method in Postman:

https://sandbox.com/AcumaticaERP/entity/DefaultExtended/22.200.001/Payment/RecordCCPayment?$PCTranNumber=xxxxxxxx

{

    "entity": {

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

        "ReferenceNbr": {"value": "598034"},

        "PaymentRef": {"value": "xxxxxxxx"}

    },

    "parameters": {

        "PCTranNumber": {"value": "xxxxxxxx"}

    }

}


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2640 replies
  • August 21, 2024

Thank you for sharing your solution with the community @bpgraves!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings