Add Credit
In order to conduct mailing transactions, your account needs to have a positive credit balance. You can add credit to your account by making a POST request to the /credit/purchase endpoint.
In the staging environment you can use the test credit card number 4111111111111111
to add any amount you like to your staging account.
The /credit/purchase endpoint has 11 required parameters. When using the test credit card, the only parameter requirement is that the expiration date must be in the future, or the "authorization" will fail.
Parameter | Description |
---|---|
billingName | Name as it appears on the card |
billingAddress1 | Billing street address line 1 |
billingCity | Billing city |
billingState | Billing state |
billingZip | Billing ZIP code |
billingAmount | User Credit Purchase Amount - $10 minimum |
billingNumber | Credit card number |
billingMonth | Expiration month - 2 digits |
billingYear | Expiration year - 2 or 4 digits |
billingCvv | Credit card verification code - 3 digits |
billingCcType | Credit card type - 2 char string, typically 'VI' or 'MC' |
The Python code below demonstrates loading $10 into the awesomeuser account in the staging environment.
# Load the HTTP requests module
import requests
# Define the endpoint to use
url = "https://stage-rest.click2mail.com/molpro/credit/purchase"
# Define credentials
myusername = 'awesomeuser'
mypassword = 'gReAt/PaSsWoRd123'
# Set up parameters for calling the endpoint
data = {'billingName' : 'Awesome User',
'billingAddress1' : '221B Baker St',
'billingCity' : 'Springfield',
'billingState' : 'MO',
'billingZip' : '34567',
'billingAmount' : '10',
'billingNumber' : '4111111111111111',
'billingMonth' : '12',
'billingYear' : '2030',
'billingCvv' : '123',
'billingCcType' : 'VI'
}
# Make the POST call
r = requests.post(url, auth=(myusername, mypassword), data=data)
# Display the result - a success should return status_code 200
print(r.status_code)
# Display the full XML returned.
print(r.text)
A successful call should return an HTTP 200 status and the XML similar to the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<credit>
<allowNegative>false</allowNegative>
<status>0</status>
<description>Success</description>
<statusUrl>http://stage-rest.click2mail.com/molpro/credit</statusUrl>
</credit>
Updated 8 months ago