SolidTrust Pay Integration Guide - Create Payment Button API

An Intro | A Quick Start | Parameters List | Result Parameters | Examples | Button Images | Error Messages

An Intro - what this documentation is for

Members wishing to accept payments on their site are required to create a Payment Button within their SolidTrust Pay account.

This API is for use by script developers who wish to automate the process of adding the Payment Button for their clients. As the details of the button such as Username, Sci_name, Payment Button Password and the various URLs are required in most scripts to automate payments, if this API is used, that data can be sent to the SolidTrust Pay site to create the button instantly for the client.

A Quick Start

A data string should be constructed and sent to:
https://www.solidtrustpay.com/accapi/createsci

Parameters List

Below you can see an explanation of all the parameters that can be used for Payment Button creation:

Parameter Name Required Details
user YES The SolidTrust Pay username of the account for which the button is to be created.
sci_name YES The name by which the Payment Button will be identified.
sci_password YES The password that is used to validate payments on return to the merchant’s website. (This is usually set in the merchant’s SolidTrust Account via the “Merchant Zone/Create Payment Button Password” area).
notify_url YES The URL where the result details will be POSTed back.
Example: http://www.yoursite.com/stp_capture.php
confirm_url YES

The URL where the updated transaction result status details will be POSTed back.
Example: http://www.yoursite.com/stp_confirm.php

cancel_url YES

The URL the payer is directed to if the payment is cancelled.
Example: http://www.yoursite.com/stp_confirm.php

return_url YES The URL where the payer will be redirected to after they complete the payment. On the last step of the payment there is a button labeled "Return" . When the payer clicks this button they are redirected to this URL. Use this parameter to redirect the payer back to the merchant’s site.
Example: http://www.yoursite.com/return_url
terms_url NO The URL containing the merchant website’s Terms and Conditions.
Example: http://www.yoursite.com/terms.php
refund_url NO The URL showing the merchant website’s Refund Policy (can be the same as the terms_url).
Example: http://www.yoursite.com/refund_policy.php
ref NO The SolidTrust Pay username of the developer. If your client has no referrer, and there is a valid username in this parameter, that username will be set as your client’s referrer.

Results

Results are provided in JSON by default.
Should you wish to receive XML, send your data string to https://www.solidtrustpay.com/accapi/createsci?type=xml
Parameter Name Details
status Either OK or FAIL
message In the case of OK, the message is Success

Error Messages

If the status is FAIL, one of the following errors will be noted in the Messages values:

Message Reason
DECLINED:!ERROR! There is already a button created users are only allowed one button per site
DECLINED:!ERROR! No account by that name no account for the given username.
DECLINED:!ERROR! No Notify URL no Notify URL provided
DECLINED:!ERROR! No Return URL no Return URL provided
DECLINED:!ERROR! No Cancel URL no Cancel URL provided
DECLINED:!ERROR! No Confirm Url no Confirm URL provided
DECLINED:!ERROR! No Password entered no Payment Button password provided
DECLINED:!ERROR! No Button Name entered. no Button name provided
DECLINED:!ERROR! Cannot set up in suspended account user is suspended
DECLINED:!ERROR! Account must be Standard Verified to create button user is not verified

Examples


A simple example of the API is below in PHP. (This sample will return XML rather than JSON).
<? $urladdress = "https://solidtrustpay.com/accapi/createsci?type=xml";
if (isset($_POST['submit']))
{
foreach($_POST as $k=>$v) $$k=urldecode($v);
$data = "user=".$user. "&sci_name=".$sci_name."¬ify_url=".$notify_url. "&return_url=".$return_url. "&cancel_url=".$cancel_url."&confirm_url=".$confirm_url. "&terms_url=".$terms_url."&refund_url=".$refund_url."&ref=".$ref."&sci_password=".$sci_password;
// Call STP API

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"$urladdress");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0); //use this to suppress output
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);// tell cURL to graciously accept an SSL certificate
$result = curl_exec ($ch) or die(curl_error($ch));
if(curl_exec($ch) === false)
{
$result = curl_error($ch);
}
else
{
curl_close ($ch);
//if json required
//$data = json_decode($result, true);
//$result = $data[status];
//$message = $data[message];

//if xml required - with some error handling
libxml_use_internal_errors(true);
$data = simplexml_load_string($result);
if ($data === false) {
echo "Failed loading XML: ";
foreach(libxml_get_errors() as $error) {
echo "
", $error->message;
}
} else {
$result = $data->status;
$message = $data->message;
}
}
if ($result == 'OK'){
//do your thing - save data etc
}
else{
//present a message to the client to tell them what went wrong
}
} else{
?>
<form method="post">

Client SCI Name <input type = text name = "sci_name" /><br>
Client SCI Password<input type = text name = "sci_password" /><br>
Client SolidTrust Pay username<input type = text name = "user" /><br>
<input type=hidden name = "notify_url" value = "https://yoursite.com/notify_url" />
<input type=hidden name = "cancel_url" value = "https://yoursite.com/cancel_url">
<input type=hidden name = "return_url" value = "https://yoursite.com/return_url" />
<input type=hidden name = "confirm_url" value ="https://yoursite.com/confirm_url" />
<input type=hidden name = "terms_url" value = "https://yoursite.com/terms_url" />
<input type=hidden name = "refund_url" value = "https://yoursite.com/refund_url" />
<input type=hidden name = "ref" value = “developer’s SolidTrust Pay username" />
<input type="submit" name = "submit" value = "Send">
</form>