asp.net - paypal invalid transaction id -
i implementing paypal express checkout functionality in asp.net project requires authorization , voiding or capturing authorized amount. i'm using api of version=104.0.
as far understand whole process, doing correctly:
i call setexpresscheckout method actiontype set "authorize" in payment details
setexpresscheckoutrequestdetailstype reqdetails = new setexpresscheckoutrequestdetailstype(); reqdetails.returnurl = "http://some.url"; reqdetails.cancelurl = "http://some.url"; reqdetails.noshipping = "1"; reqdetails.orderdescription = "you're buy items " + payment.amount.tostring("f"); reqdetails.cpplogoimage = "http://some.ulr/image.jpb"; reqdetails.paymentdetails = new paymentdetailstype[1]; reqdetails.paymentdetails[0] = new paymentdetailstype(); reqdetails.paymentdetails[0].paymentdetailsitem = new paymentdetailsitemtype[cart.lineitems.count]; int = 0; foreach (lineitemmodel li in cart.lineitems) { paymentdetailsitemtype item = new paymentdetailsitemtype(); item.amount = new basicamounttype(); item.amount.value = li.totalincludingshipping.tostring("f"); item.amount.currencyid = currencycodetype.aud; item.name = li.productitem.displayname; item.number = li.productitem.sku; item.quantity = li.quantity.tostring(); item.description = ""; reqdetails.paymentdetails[0].paymentdetailsitem.setvalue(item, i); i++; } reqdetails.ordertotal = new basicamounttype() { currencyid = currencycodetype.aud, value = payment.amount.tostring("f") }; reqdetails.paymentdetails[0].paymentaction = paymentactioncodetype.authorization; reqdetails.paymentdetails[0].paymentactionspecified = true; setexpresscheckoutreq req = new setexpresscheckoutreq() { setexpresscheckoutrequest = new setexpresscheckoutrequesttype() { version = "104.0", setexpresscheckoutrequestdetails = reqdetails } };
- it goes fine , in back-end of paypal in notification test personal account can see message amount of money autorized
then call doexpresscheckout. here code of request
doexpresscheckoutpaymentreq payreq = new doexpresscheckoutpaymentreq() { doexpresscheckoutpaymentrequest = new doexpresscheckoutpaymentrequesttype() { version = configurationmanager.appsettings["paypalapiversion"], doexpresscheckoutpaymentrequestdetails = new doexpresscheckoutpaymentrequestdetailstype() { token = token, payerid = payerid, paymentdetails = new paymentdetailstype[1] } } }; payreq.doexpresscheckoutpaymentrequest.doexpresscheckoutpaymentrequestdetails.paymentaction = paymentactioncodetype.authorization; payreq.doexpresscheckoutpaymentrequest.doexpresscheckoutpaymentrequestdetails.paymentactionspecified = true; payreq.doexpresscheckoutpaymentrequest.doexpresscheckoutpaymentrequestdetails.paymentdetails[0] = new paymentdetailstype(); payreq.doexpresscheckoutpaymentrequest.doexpresscheckoutpaymentrequestdetails.paymentdetails[0].paymentaction = paymentactioncodetype.authorization; payreq.doexpresscheckoutpaymentrequest.doexpresscheckoutpaymentrequestdetails.paymentdetails[0].paymentactionspecified = true; payreq.doexpresscheckoutpaymentrequest.doexpresscheckoutpaymentrequestdetails.paymentdetails[0].ordertotal = new basicamounttype(); payreq.doexpresscheckoutpaymentrequest.doexpresscheckoutpaymentrequestdetails.paymentdetails[0].ordertotal.currencyid = currencycodetype.aud; payreq.doexpresscheckoutpaymentrequest.doexpresscheckoutpaymentrequestdetails.paymentdetails[0].ordertotal.value = total.tostring("f");
this request returns "success" too. save response's doexpresscheckoutpaymentresponsedetails.paymentinfo[0].transactionid future use
but when run doauthorize transaction id previous response, "failure". here request code:
doauthorizationreq authreq = new doauthorizationreq() { doauthorizationrequest = new doauthorizationrequesttype() { version = "104.0", transactionid = docheckouttransactionid } }; authreq.doauthorizationrequest.amount = new basicamounttype(); authreq.doauthorizationrequest.amount.currencyid = currencycodetype.aud; authreq.doauthorizationrequest.amount.value = total.tostring("f");
the response says "failure" , errors array contains 1 item errorcode=10609 , message "invalid transaction id"
do have thoughts why happening?
thanks lot!
to capture funds after authorization need run docapture, not doauthorization.
Comments
Post a Comment