SDK Payment.Update

ToddDtown
Contributor
Contributor

I am trying to update a payment when the payment total changes due to shipping method changes, gift certificate application, etc... and I keep getting a 400 Bad Request whenever I run the update.  I've tried all kinds of path configurations on the Patch with no luck.  Not sure if it's something wrong with my Patch setup or what but here is my code. 

 

var updatedPayment = new Payment();
            var updatedTransaction = new Transaction
            {
                amount = new Amount
                {
                    total = newTotal
                }
            };

            updatedPayment.transactions = new List<Transaction>
            {
                updatedTransaction
            };

            var patchRequest = new PatchRequest
            {
                new Patch
                {
                    op = "replace",
                    path = "/transactions/0/amount",
                    value = updatedPayment.transactions[0].amount
                }
            };

            Payment.Update(_apiContext, paymentId, patchRequest);
Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.