BlueSnap is a global payment gateway which supports credit and debit card payments, ACH/ECP, SEPA Direct Debit, digital wallets, and Paypal. Its Payment API is RESTful and uses standard HTTP features. Bluesnap API supports automatic recurring subscription and we utilize this feature and implement as Custom Drupal 7 Module. We use cURL to get the response in Json format.

Implementation Steps:

1.1 Create a Subscription Plan

Sample:


curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/plans\

-H'Content-Type: application/json'\

-H'Accept: application/json'\ 

-H'Authorization:Basic dXNlcm5hbWU6cGFzc3dvcmQ='\

-d'
{
  "chargeFrequency":"MONTHLY",

  "name":"Gold Plan",

  "currency":"USD",

  "recurringChargeAmount":29.99
}'

1.2 Update/Retrieve Specific Plan

Sample:
 curl -v -X GET https://sandbox.bluesnap.com/services/2/recurring/plans/2283845\

-H'Content-Type: application/json'\

-H'Accept: application/json'\ 

-H'Authorization:Basic dXNlcm5hbWU6cGFzc3dvcmQ='\
-d '

1.3 Create Subscription

Sample:
  
curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions\

-H'Content-Type: application/json'\

-H'Accept: application/json'\

-H'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ='\
-d '
{
 "payerInfo":{
    "zip":12345,
       "firstName":"John",
       "lastName":"Doe",
       "phone": 1234567890
    },
    "paymentSource":{"creditCardInfo":{"creditCard":{
       "expirationYear":2019,
       "securityCode":111,
       "expirationMonth":"07",
       "cardNumber":4111111111111111
 }}},
       "planId":2283845,
       "transactionFraudInfo":{"fraudSessionId":1234}
}'
 

1.4 Update/Retrieve Subscription

  Sample:

curl -v -X GET https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491535\
-H'Content-Type: application/json'\
-H'Accept: application/json'\ 
-H'Authorization:Basic dXNlcm5hbWU6cGFzc3dvcmQ='\
-d '

2. Convert currency from Base currency to USD in Paypal payment in Magento 2.2.3

Magento uses default Magento-Paypal module for Paypal payment gateway. So the payment currency codes and the functionality calls from the core module. In order to alter that we have to override the existing functionality and extend it as a new module.