Where do I get the token for the vaulted card information with the BlueSnap Payment API? - bluesnap

I'm vaulting credit card data on BlueSnap, using the vaulted shopper request. How do I get the token of the vaulted card data? I get an empty body in response to my request..

The BlueSnap token for the vaulted shopper info will be returned in the URL in the location header. For example:
location: https://sandbox.bluesnap.com/services/2/vaulted-shoppers/20848977
In this case, the vaulted-shopper-id (token) is 20848977

Related

Verify Client Side Express Checkout from Server

I have implemented client side checkout as demo'd here https://developer.paypal.com/demo/checkout/#/pattern/client. Its working fine while testing with sandbox account. But I am concerned about how we can verify whether the payment has actually gone through from the server side?
For eg: if the user executed a payment for Order number 'X', I want to make sure that the payment has been successful. I noteiced the transaction Id which I understand is generated by paypal only if the payment has gone through and we can recieve that Id in the parameter for payment execute call back:
actions.payment.execute().then(function (payment) { // where payment.transactions[0].related_resources[0].sale.id is some value say 'xxx' });
The same Unique Id can be seen in the sandbox transaction details page (https://www.sandbox.paypal.com/webscr?cmd=_history-details-from-hub&id=xxx) as Unique Transaction IDxxx. Is there a way (a paypal endpoint) to verify this through a server side call? That is verfiy that the Transaction Id received at the server is a valid one from paypal.
Excuse my ignorance, are webhook events meant to do this?
You can use IPN/Webhooks, then PayPal will send a notification to you for every payment with the transaction id, payment details. You can use that information for verifying the payment.
Get an access token
First we need to have an oAuth token from paypal. For this we need to do a POST to https://api.sandbox.paypal.com/v1/oauth2/token (sandbox url) passing our PayPal app's client Id and Secret.
Details of the HttpClient object I used in C#:
DefaultRequestHeaders.Accept: application/json
DefaultRequestHeaders.AcceptLanguage: en_US
DefaultRequestHeaders.Authorization: AuthenticationHeaderValue of Basic scheme, parameter of Base64String of bytes encoded from (clientId:clientSecret).
The response will have the property access_token which has the access token we want to pass in the next request to get the status of the transaction. For more details on getting access token refer: https://developer.paypal.com/docs/api/overview/#get-an-access-token.
Get sale details
Now to make the request for sale/transaction details as said here: https://developer.paypal.com/docs/api/payments/v1/#sale_get.
Do a GET passing the access token as Bearer token in the Authorization header.
And the unique transaction Id as parameter for the sale id. The response will have the property "state". Having the value "COMPLETED" ensures the transaction has gone successfully.

Paypal express checkout get receipt id in response

Is there a way I can get paypal receipt id in response when using paypal express checkout.
I do get the transaction id but i need receipt id. Paypal is sending receipt id to customer via mail but i need it in API response.
Only way to get Receipt ID, you have to call the GetTransactionDetails api and can get receipt id from here.
Docs: https://developer.paypal.com/docs/classic/api/merchant/GetTransactionDetails_API_Operation_NVP/

No auth id assigned for intent=authorize

I think the ReSt authorization API is broken, I don't get back the ID for the auth object when doing POST /payment with intent=authorize.
Even calling GET /v1/payments/payment/{id} I don't get an auth id.
Here's the http log: http://pastebin.com/e1bEjfBF
As you can see I get "related_resources":[{"authorization":{"create_time"... but there is no id.
The pastbin sample shows the lookup of a payment resource that has not been approved yet.
Generally, for a PayPal Payment in Rest, you will have to:
Create a PayPal payment (POST payment request to https://api.sandbox.paypal.com/v1/payments/payment)
Redirect the buyer to the returned Approval_URL (usually something like https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=)
Upon return of the buyer to the return_url you specified in step 1, execute the payment (POST the PayerID to https://api.sandbox.paypal.com/v1/payments/payment/PAY-xxxx/execute/)
When you now lookup the Pay-Key, you should see the state of the Pay-Key as "approved", included buyer details, an Authorization TXN-ID and authorization state of "Authorized".
The next step would be to call the appropriate HATEOAS links to capture, void or reauthorize the authorization.
I've uploaded a sample flow to http://pastebin.com/JWG8Gzuv
You can also refer to the developer documentation located under https://developer.paypal.com/webapps/developer/docs/integration/direct/capture-payment/

Getting Transaction details on Enhanced recurring payment service

My application comprises of a subscription service. I have implemented the section using Paypal standard. What i did to make a recurring a recurring profile is to do a SetExpressChekout call initially and then with the response token, i redirect the browser to Paypal and there he could login to Paypal and accept the terms and condition for the payment and then the browser will be redirect back to the url i specified as the return url with token as the query string. With this token i make a doexpresscheckout api call and then convert the transaction to a recurring profile, the profile id, transaction id will be stored in database for refund transaction, recurring profile cancellation etc. And also this profile id is needed in IPN which logs further recurring payment transaction in my database successfully. Everything works fine in this environment.
Now my customer needs to have credit card transaction along with Paypal transaction. For that he has sign up for enhanced recurring payment. I have created a subscription button with item name amount currency success and cancel url and generated the html for the hosted buton and pasted it in my form. On clicking the button the browser gets redirected to paypal and i could pay with both paypal and credit card. Once the payment is completed and i am redirecting back to success url. but my success url query sting only contains auth parameter. I am getting no idea on how to use this parameter to get the details of the recurring payment like profile id and transaction id to log to my database. If it is received only via IPN how could i know whether the profile id belongs to which user.
Thanks and regards
With Website Payments Standard you can set the custom parameter to contain specific data about the user.
For example;
<input type="hidden" name="custom" value="hashedStringofUserID">
This data will subsequently be returned in the IPN POST payload's custom key.

Paypal Express checkout - not getting billing agreement ID

I'm trying to test reference transaction with Paypal Expresscheckout billing agreement id. But I don't get the BAID at all.
Here are the calls I'm making:
STEP 1: setExpresschecout call:
Request
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
------------------------------------------------------------
POST data:
USER=insert_merchant_user_name_here
&PWD=insert_merchant_password_here
&SIGNATURE=insert_merchant_signature_value_here
&METHOD=SetExpressCheckout
&VERSION=93
&PAYMENTACTION=SALE # type of payment
&AMT=19.95 # amount of transaction
&CURRENCYCODE=USD # currency of transaction
&RETURNURL=<return_url> # URL of your payment confirmation page
&CANCELURL= <cancel_url> # URL redirect if customer cancels payment
&L_BILLINGTYPE0=MerchantInitiatedBilling
-------------------
Response
----------------------
token=EC-7NH28597U8423791A
-----------------------
It's reirecting me to Paypal for login and after clicking on 'Agree and Pay' button, redirecting me back to my site with token and payerID. As I don't need to store the customer details, I'm skipping GetExpresschecout call and directly calling doExpressCheckoutPayment with token and PayedID.
STEP2 : doExpresschecoutpayment
USER=insert_merchant_user_name_here
&PWD=insert_merchant_password_here
&SIGNATURE=insert_merchant_signature_value_here
&METHOD=DoExpressCheckoutPayment
&VERSION=93
&PAYMENTACTION=SALE # type of payment
&AMT=19.95 # amount of transaction
&CURRENCYCODE=USD # currency of transaction
&TOKEN=token_value
&PAYERID=payer_id_received
Here is the response. But it doesn't have the BILLING agreement id.
{"map":{"PAYMENTINFO_0_REASONCODE":"None","PAYMENTINFO_0_TAXAMT":"0.00","PAYMENTINFO_0_SECUREMERCHANTACCOUNTID":"KLQ6JKXB6DPZ6","TRANSACTIONID":"96C270379E2177052","PAYMENTINFO_0_TRANSACTIONTYPE":"expresscheckout","AMT":"11.20","PAYMENTINFO_0_FEEAMT":"0.62","CORRELATIONID":"fa14c423b7813","SUCCESSPAGEREDIRECTREQUESTED":"false","TAXAMT":"0.00","PAYMENTINFO_0_CURRENCYCODE":"USD","PAYMENTINFO_0_TRANSACTIONID":"96C270379E2177052","PENDINGREASON":"None","PAYMENTINFO_0_PAYMENTTYPE":"instant","VERSION":"98.0","PAYMENTINFO_0_PENDINGREASON":"None","FEEAMT":"0.62","ACK":"Success","TRANSACTIONTYPE":"expresscheckout","TOKEN":"EC-7NH28597U8423791A","PAYMENTINFO_0_ERRORCODE":"0","BUILD":"5956203","PAYMENTINFO_0_ORDERTIME":"2013-05-12T12:55:48Z","PAYMENTINFO_0_PROTECTIONELIGIBILITY":"Eligible","INSURANCEOPTIONSELECTED":"false","ORDERTIME":"2013-05-12T12:55:48Z","PAYMENTSTATUS":"Completed","PAYMENTINFO_0_AMT":"11.20","PAYMENTINFO_0_PAYMENTSTATUS":"Completed","REASONCODE":"None","PAYMENTTYPE":"instant","PAYMENTINFO_0_ACK":"Success","PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE":"ItemNotReceivedEligible,UnauthorizedPaymentEligible","SHIPPINGOPTIONISDEFAULT":"false","TIMESTAMP":"2013-05-12T12:55:48Z","PROTECTIONELIGIBILITY":"Eligible","CURRENCYCODE":"USD"}}
FYI..paymentaction is set to SALE as I need to capture the payment.
Any suggestions on what went wrong?
Thanks,
Punya
You will need to run CreateBillingAgreement API to get BAID.
This should be done after you get EC token from SetExpressCheckout API.
P.S Reference Transaction should be enabled on your account.
You will need to use "GetExpressCheckout" to see if they accepted the billing agreement or not.
You will also need to contact PayPal and specifically request that Billing Agreements and subsequently Reference Transactions are turned on for your merchant account.