cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

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
Who Me Too'd this topic