function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MartinKMartinK 

Paypal X Adaptive Payments Toolkit

I started to implement the Paypal Adaptive Payments Toolkit. I had it running great in my sandbox... I started running test cases on it and had to make some minor adjustments.  Now when I make a Pay request from the toolkit. during the Callout I receive the following error.  You have uncommitted work pending. Please commit or rollback before calling out.  The exception is thrown after the HTTP Request is created by the PPHttpUtil  and the System.Http.send method invoked. 

 

Is anyone familar with this particular error?  

 

Thank you!!!

My common parameters and API credentials are all valid.For grins here is my PayRequest ActionType=Pay, CancelUrl=https://cs7.salesforce.com/Invoice?Id=006M0000001fKhBIAU&MainMessage=cancel, ClientDetails=PPClientDetails:[ApplicationId=Paypal1, CustomerId=, CustomerType=, DeviceId=, GeoLocation=, IpAddress=96.242.149.48, Model=, PartnerName=], CurrencyCode=USD, FeesPayer=EACHRECEIVER, FundingtypeList=(), IpnNotificationUrl=, LogDefaultShippingAddress=false, Memo=PayApiTest, PPRequest.ApiName=Pay, PPRequest.RequestEnvelope=PPRequestEnvelope:[DetailLevelCode=ReturnAll, ErrorLanguage=en_US], Pin=, PreapprovalKey=, ReceiverList=(PPReceiver:[Amount=210.00, Email=m2_1298923492_biz@my.com, InvoiceId=W-00002, PaymentSubType=null, PaymentType=, Phone=null, Primary=null]), ReturnUrl=https://cs7.salesforce.com/InvoicePayment?Id=a01M0000000atJ1IAI, ReverseAllParallelPaymentsOnError=false, SenderEmail=null, TrackingId=]
Best Answer chosen by Admin (Salesforce Developers) 
MartinKMartinK

So I figured out the issue.  Apparently HTTP Callouts require all database transactions to be committed.  APEX code only commits when the APEX Script is completed (since there is no explicit commit in APEX).