We are here 24/7, keeping an eye on things and making sure everything runs smoothly.
This API is responsible for creating new plan.
The table describes the request parameters for Add Plan API.
Variable Name | Description | Required | Expected Values |
---|---|---|---|
username | MSD Gateway Username | Y | MSD Gateway Username |
api_key | MSD Gateway API Key | Y | MSD Gateway API Key |
plan_name | The Plan Name | Y | Plan Name |
period_type | Period Type | Y | WEEKLY, FORTNIGHTLY, MONTHLY, QUARTERLY, YEARLY |
amount | Amount to be charged | Y | 115.45 |
currency | Currency of Transaction (allowed currencies will be determined during the time of merchant onboarding). | Y | USD, EUR, GBP, CAD, AUD, NZD, AED, DKK, MXN, SEK, CHF |
no_of_charge | No of times to charge | Y | No of charge should be greater than 0 |
Example
<form name="" action="https://portal.merchantservicedepot.com/apis/add_plan.php" method="post" > <input type="text" name="username" value="msdusername"/> <input type="text" name="api_key" value="msdapikey"/> <input type="text" name="plan_name" value="planname"/> <input type="text" name="period_type" value="WEEKLY"/> <input type="text" name="amount" value="115.45"/> <input type="text" name="currency" value="USD"/> <input type="text" name="no_of_charge" value="2"/> <input type="submit" value="submit" /> </form>
{"response":{ "description": "Plan is successfully created", "code": "00" }
This API is responsible to update existing subscription plan.
The table describes the request parameters for Update Plan API.
Variable Name | Description | Required | Expected Values |
---|---|---|---|
username | MSD Gateway Username | Y | MSD Gateway Username |
api_key | MSD Gateway API Key | Y | MSD Gateway API Key |
plan_id | Plan ID | Y | Existing Plan ID |
plan_name | Plan Name | Y | Plan Name |
amount | Amount to be charged | Y | 115.45 |
currency | Currency of Transaction (allowed currencies will be determined during the time of merchant onboarding). | Y | USD, EUR, GBP, CAD, AUD, NZD, AED, DKK, MXN, SEK, CHF |
no_of_charge | No of times to charge | Y | No of charge should be greater than 0 |
Example
<form name="" action="https://portal.merchantservicedepot.com/apis/update_plan.php" method="post" > <input type="text" name="username" value="msdusername"/> <input type="text" name="api_key" value="msdapikey"/> <input type="text" name="plan_id" value="existingplanid"/> <input type="text" name="plan_name" value="plan name"/> <input type="text" name="amount" value="115.45"/> <input type="text" name="currency" value="USD"/> <input type="text" name="no_of_charge" value="2"/> <input type="submit" value="submit" /> </form>
The response of the API Call is a JSON array. For Error, two elements are returned, code and description. For Successful transactions, three elements are returned, code, description, and transaction_id. The response code for a successful API call is always 00.
{"response":{ "description": "Plan is successfully Updated", "code": "00" }
This API is responsible for creating new payment transactions, and this API is compatible with both encrypted and plain credit card methods of transactions.
The table describes the request parameters for List Plan API.
Variable Name | Description | Required | Expected Values |
---|---|---|---|
username | MSD Gateway Username | Y | MSD Gateway Username |
api_key | MSD Gateway API Key | Y | MSD Gateway API Key |
plan_id | Plan ID | N | Specify an existing plan id, to view specific plan details |
Example
<form name="" action="https://portal.merchantservicedepot.com/apis/list_plan.php" method="post" > <input type="text" name="username" value="msdusername"/> <input type="text" name="api_key" value="msdapikey"/> <input type="text" name="plan_id" value=""/> <input type="submit" value="submit" /> </form>
{"response":{"code":"00","description":"Success","list":[{"plan_id":47,"plan_name":"SMTEST12","period_type":"FORTNIGHTLY","amount":"6.18","currency":"USD","no_of_charge":0}]}}
This API is responsible for adding a subscription using Apple Pay.
The table describes the request parameters for Delete Plan API.
Variable Name | Description | Required | Expected Values |
---|---|---|---|
username | MSD Gateway Username | Y | MSD Gateway Username |
api_key | MSD Gateway API Key | Y | MSD Gateway API Key |
plan_id | Plan ID | Y | Existing plan id |
Example
<form name="" id="formID" action="https://portal.merchantservicedepot.com/apis/delete_plan.php" method="post" > <input type="text" name="username" value="msdusername"/> <input type="text" name="api_key" value="msdapikey"/> <input type="text" name="plan_id" value="existingplanid"/> <input type="submit" value="submit" /> </form>
The response of the API Call is a JSON array. For Error, two elements are returned, code and description. For Successful transactions, three elements are returned, code, description, and transaction_id. The response code for a successful API call is always 00.
{"response":{ "description": "Plan is successfully deleted", "code": "00" }
This API is responsible for adding a subscription.
The table describes the request parameters for Add Subscription API.
Variable Name | Description | Required | Expected Values |
---|---|---|---|
username | MSD Gateway Username | Y | MSD Gateway Username |
api_key | MSD Gateway API Key | Y | MSD Gateway API Key |
plan_id | Plan ID | Y | Existing Plan ID |
creditcard_number | Credit Card number that will be used to complete the transaction. | Y | 4111111111111111 |
expire_month | Expiry Month of the Credit Card. | Y | 06 |
expire_year | Expiry Year of the Credit Card. | Y | 2025 |
first_name | First name of the cardholder | Y | Roberto |
last_name | Last name of the cardholder | Y | Diaz |
address | Address of the cardholder | N | 4446 Green Avenue, Suite 56 |
city | City of the cardholder | N | Los Angeles |
Example
<form name="" action="https://portal.merchantservicedepot.com/apis/add_subscription.php" method="post" > <input type="text" name="username" value="msdusername"/> <input type="text" name="api_key" value="msdapikey"/> <input type="text" name="plan_id" value="existingplanid"/> <input type="text" name="creditcard_number" value="4111111111111111"/> <input type="text" name="expire_month" value="06"/> <input type="text" name="expire_year" value="2025"/> <input type="text" name="first_name" value="Roberto"/> <input type="text" name="last_name" value="Diaz"/> <input type="text" name="address" value="4446 Green Avenue, Suite 56"/> <input type="text" name="city" value="Los Angeles"/> <input type="text" name="state" value="CA"/> <input type="text" name="zip_code" value="94085"/> <input type="text" name="country_code" value="US, CN"/> <input type="text" name="email" value="[email protected]"/> <input type="text" name="start_date" value="Subscription Start Date"/> <input type="text" name="memo" value="memoofthetransaction"/> <input type="submit" value="submit" /> </form>
The response of the API Call is a JSON array. For Error, two elements are returned, code and description. For Successful transactions, three elements are returned, code, description, and transaction_id. The response code for a successful API call is always 00.
{"response":{ "description": "Subscription is successfully created", "code": "00" }
This API is responsible to add subscription using Apple Pay.
Integrating Apple Pay to your application is a three step process, first call the javascript, display the Apple Pay button and finally send the reponse to processing API. All the steps are described below.
MSD will provide apple-developer-merchantid-domain-association.txt file. This file must be uploaded to a folder called /.well-known/ at the document root of the web server.This is required to verify the domain.
Example
<script type="text/javascript" src="https://[server-name]/services/applePay.js"></script>
2. Display an Apple Pay button: The example code below is to display Apple Pay button. Set the style and locale where you add the button.
Example
/* CSS */ #applePay { width: 150px; height: 50px; display: none; border-radius: 5px; margin-left: auto; margin-right: auto; margin-top: 20px; background-image: -webkit-named-image(apple-pay-logo-white); background-position: 50% 50%; background-color: black; background-size: 60%; background-repeat: no-repeat; } /* HTML */ <button type="button" id="applePay" onclick="callPayment()"></button>
3. Implement the request and response function. The msdApplePay.paymentRequestRecurring function will be called when click on Apple Pay Button. This function accepts 4 parameters (app_key,business_name,plan_details,start_date). The msdApplePay.paymentResponse function will be invoked once the Apple Pay response is returned from our system. This function has 2 parameters (responseStatus,responseText). Parameter responseText is used as an input parameter to apple_subscription.php API. Value of responseStatus is S for success.
This table describes the request parameters for Apple pay js.
Parameter Name | Description | Required | Expected Values |
---|---|---|---|
app_key | This is MD5 of MSD Gateway Username and 16 digit Secret key | Y | If Username is test and Secret key is abcdefgh12345678 |
business_name | Display this name in Apple Pay window | Y | Test shop |
plan_details | Get paln details using list_plan.php API | Y | {"plan_id":XX,"plan_name":"Test plan","period_type":"WEEKLY","amount":"1.30","currency":"USD","no_of_charge":2} |
start_date | Subscription Start Date | Y | YYYY-MM-DD |
<script type="text/javascript" > function callPayment() { var app_key="b0cf87c7e314af8638ce34732f1f7d24"; var business_name="Test shop"; var plan_details='{"plan_id":XX,"plan_name":"Test plan","period_type":"WEEKLY","amount":"1.30","currency":"USD","no_of_charge":2}'; msdApplePay.paymentRequestRecurring(app_key,business_name,plan_details,start_date); } msdApplePay.paymentResponse=function(responseStatus,responseText){ if(responseStatus=="S") { document.getElementById('signature_token').value = responseText; document.getElementById("formID").submit(); }else{ alert(responseText); } } </script>
The table describes the request parameters for Apple Pay Subscription API.
Variable Name | Description | Required | Expected Values |
---|---|---|---|
username | MSD Gateway Username | Y | MSD Gateway Username |
api_key | MSD Gateway API Key | Y | MSD Gateway API Key |
signature_token | Get a token from msdApplePay.paymentResponse | Y | {"identifyKey":"test","data":"test", ephemeralPublicKey":"test","publicKeyHash":"test", transactionId":"test","signature":"test", version":"EC_v1","displayName":"MasterCard 1111", network":"MasterCard","type":"credit"} |
first_name | First name of the cardholder | Y | Roberto |
last_name | Last name of the cardholder | Y | Diaz |
address | Address of the cardholder | N | 4446 Green Avenue, Suite 56 |
city | City of the cardholder | N | Los Angeles |
state | State of the cardholder | N | CA |
zip_code | Zip code of the cardholder | Y | 94085 |
country_code | Country of the cardholder(ISO alpha-2) | Y | US, CN |
<form name="" id="formID" action="https://portal.merchantservicedepot.com/apis/apple_subscription.php" method="post"> <input type="text" name="username" value="msdusername"/> <input type="text" name="api_key" value="msdapikey"/> <input type="text" name="signature_token" value="{"identifyKey":"test","data":"test","ephemeralPublicKey":"test","publicKeyHash":"test","transactionId":"test","signature":"test","version":"EC_v1","displayName":"MasterCard 1111","network":"MasterCard","type":"credit"}"/> <input type="text" name="first_name" value="Roberto"/> <input type="text" name="last_name" value="Diaz"/> <input type="text" name="address" value="4446 Green Avenue, Suite 56"/> <input type="text" name="city" value="Los Angeles"/> <input type="text" name="state" value="CA"/> <input type="text" name="zip_code" value="94085"/> <input type="text" name="country_code" value="US, CN"/> <input type="text" name="email" value="[email protected]"/> <input type="text" name="memo" value="memoofthetransaction"/> <br/> <button type="button" id="applePay" onclick="callPayment()"></button> </form> <script type="text/javascript" > function callPayment() { var app_key="b0cf87c7e314af8638ce34732f1f7d24"; var business_name="Test shop"; var plan_details='{"plan_id":XX,"plan_name":"Test plan","period_type":"WEEKLY","amount":"1.30","currency":"USD","no_of_charge":2}'; msdApplePay.paymentRequestRecurring(app_key,business_name,plan_details,start_date); } msdApplePay.paymentResponse=function(responseStatus,responseText){ if(responseStatus=="S") { document.getElementById('signature_token').value = responseText; document.getElementById("formID").submit(); }else{ alert(responseText); } } </script>
The response of the API Call is a JSON array. For Error, two elements are returned, code and description. For Successful transactions, three elements are returned, code, description, and transaction_id. The response code for a successful API call is always 00.
{"response":{ "description": "Subscription is successfully created", "code": "00" }
This API is responsible for fetching details of subscriptions.
The table describes the request parameters for Subscription List API.
Variable Name | Description | Required | Expected Values |
---|---|---|---|
username | MSD Gateway Username | Y | MSD Gateway Username |
api_key | MSD Gateway API Key | Y | MSD Gateway API Key |
plan_id | Plan ID | N | Existing Plan ID |
card_type | Card Type | N | AMEX, DISCOVER, MASTERCARD, VISA |
start_date | Start Date | N | Start Date |
end_date | End Date | N | End Date |
Example
<form name="" action="https://portal.merchantservicedepot.com/apis/list_subscription.php" method="post" > <input type="text" name="username" value="msdusername"/> <input type="text" name="api_key" value="msdapikey"/> <input type="text" name="plan_id" value="existingplanid"/> <input type="text" name="card_type" value="VISA"/> <input type="text" name="start_date" value="startdate"/> <input type="text" name="end_date" value="enddate"/> <input type="submit" value="submit" /> </form>
{"response":{"code":"00","description":"Success","list":[{"subscription_id":59,"plan_id":30,"plan_name":"Plan test fortnightly","credit_card_number":"**** **** **** 0007 ","amount":7,"currency":"USD","period_type":"FORTNIGHTLY","first_name":"Tanmoy","last_name":"Mondal","address":"802 E Frierson Ave","address_cont":"","city":"TAMPA","state":"FL","zip":"33606","country_id":209,"country_name":"United States","bill_email":"[email protected]","start_date":"2023-05-25"},{"subscription_id":56,"plan_id":30,"plan_name":"Plan test fortnightly","credit_card_number":"**** **** **** 0007 ","amount":7,"currency":"USD","period_type":"FORTNIGHTLY","first_name":"Tanmoy","last_name":"Mondal","address":"802 E Frierson Ave","address_cont":"","city":"TAMPA","state":"FL","zip":"33606","country_id":209,"country_name":"United States","bill_email":"[email protected]","start_date":"2023-05-22"}]}}
This API is responsible for removing existing subscription.
The table describes the request parameters for Delete Subscription API.
Variable Name | Description | Required | Expected Values |
---|---|---|---|
username | MSD Gateway Username | Y | MSD Gateway Username |
api_key | MSD Gateway API Key | Y | MSD Gateway API Key |
subscription_id | Subscription ID | Y | Existing Subscription ID |
Example
<form name="" action="https://portal.merchantservicedepot.com/apis/delete_subscription.php" method="post" > <input type="text" name="username" value="msdusername"/> <input type="text" name="api_key" value="msdapikey"/> <input type="text" name="subscription_id" value="existingsubscriptionid"/> <input type="submit" value="submit" /> </form>
The response of the API Call is a JSON array. For Error, two elements are returned, code and description. For Successful transactions, three elements are returned, code, description, and transaction_id. The response code for a successful API call is always 00.
{"response":{ "description": "Subscription is successfully deleted", "code": "00" }
Code | Description |
---|---|
01 | Username is missing or invalid |
02 | Credit Card is missing or invalid |
03 | Expire month is missing or invalid |
04 | First name is missing or invalid |
05 | Country code is missing or invalid |
06 | Email is missing or invalid |
07 | Address is missing |
08 | City is missing |
09 | API Key is missing or invalid |
10 | Zipcode is missing |
11 | Start date is missing |
12 | Plan id is missing or invalid |
13 | State is missing |
14 | Plan Name is missing |
15 | Period Type is missing or invalid |
16 | No of Charge is missing |
17 | Amount is missing or invalid |
18 | Currency is missing |
19 | Same Plan already exists |
20 | Currency is not assigned to this account |
21 | Message contains words that have been identified as profanity and this message has been blocked due to company policy. Please try again. |
22 | No of charge should be greater than 0 |
23 | CVV is missing or invalid |
24 | Invalid card |
UN | Unknown error, Please contact Administrator |