The Sandbox Environment

The Sandbox environment is available to you immediately so you can begin testing straight away. This environment does not require that a service has been approved by an Operator.

The environment is determined by the credentials that you use to authenticate your API calls. So if you are using Sandbox credentials your requests will automatically go to the Sandbox.

Provision

In order to use the Sandbox environment you must set up a MSISDN to work with. The Provision API provisions a MSISDN in the Sandbox with some credit. A MSISDN is only provisioned for a maximum of 4 hours. After that it will need re-provisioned.

The provisioned MSISDN must also satisfy the MSISDN requirements for the operator such as starting with the country code.

HTTP Request

POST /v2.2/sandbox/provision?msisdn={msisdn}&merchant={merchant}&amount={amount}&currency={currency}

Request Parameters

NameDescriptionTypeUsage
msisdnThe subscriber's MSISDN that you want to provision.stringmandatory
merchantThe Alacrity merchant URI that identifies which merchant this transaction belongs to.stringmandatory
amountThe amount that you want to provision.numericmandatory
currencyThe currency associated with the MSISDN.stringmandatory
POST /v2.2/sandbox/provision?
msisdn=965987654321&
merchant=partner:00ow34-al6g67-12o6hh-00ff66&
amount=30&
currency=KWD HTTP/1.1
Host: api.sla-alacrity.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json

{
  "success": true
}

πŸ“˜

Info

Transactions in the Sandbox will effect the balance in the same way as real purchases.
An MSISDN is only provisioned for a maximum of 4 hours. After that it will need to be re-provisioned.

Provision Token

Provision a TOKEN for a MSISDN in the Sandbox with some credit using the Provision Token API. The token is required on a few API calls.

HTTP Request

POST /v2.2/sandbox/provision_token?msisdn={msisdn}&merchant={merchant}&campaign={campaign}&amount={amount}&currency={currency}

Request Parameters

NameDescriptionTypeUsage
msisdnThe subscriber's MSISDN that you want to provision.stringmandatory
merchantThe Alacrity merchant URI that identifies which merchant this transaction belongs to.stringmandatory
campaignThe Alacrity service URI that identifies the service that this transaction belongs to.stringmandatory
amountThe amount that you want to provision.numericmandatory
currencyThe currency associated with the MSISDN.stringmandatory
POST /v2.2/sandbox/provision_token?
msisdn=965987654321&
merchant=partner:00ow34-al6g67-12o6hh-00ff66&
campaign=campaign:00ow34-al6g67-12o6hh-00ff66&
amount=30&
currency=KWD HTTP/1.1
Host: api.sla-alacrity.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json

{
  "success": true,
  "token": "TOKEN:1c86724f-b09b-4bed-be8f-4683se8efs34"
}

πŸ“˜

Info

The deducted price will be the whole amount you have provisioned with that token.
The TOKEN is eligible to be used only one time per create subscription.

Balance

Receive the list of provisioned MSISDNs with their balances using their Balance API.

HTTP Request

POST /v2.2/sandbox/balances?merchant={merchant}&msisdn={msisdn}

Request Parameters

NameDescriptionTypeUsage
merchantThe Alacrity merchant URI that identifies which merchant this transaction belongs to.stringmandatory
msisdnThe subscribers MSISDN that you want to check the balance for.stringoptional
POST /v2.2/sandbox/balances?
merchant=partner:00ow34-al6g67-12o6hh-00ff66 HTTP/1.1
Host: api.sla-alacrity.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json

{
  "965987654321": 30.000,
  "965912345678": 1.500
}

Checkout

Checkout is the recommended flow for most Operators so you should use it in the Sandbox. Note the addition of the env=test parameter which is not needed in production.

You need to follow these steps in order to use the Checkout in Sandbox:

  1. Provision a MSISDN using the Provision API

  2. Construct the request needed using the below sample request and ensure that you add the env params with 'test' value. For more detail on Checkout see here.

http://msisdn.sla-alacrity.com/purchase?merchant={merchant}&service={campaign}&env=test&redirect_url=http://test.com/api/callback/123&correlator=12312-86421-123425

  1. Follow the steps on the Checkout flow by inserting the MSISDN in the page, and then click on Send PIN button.

  2. Enter the Dummy Pin

  3. You will receive a token for the associated redirect_url that you provided in the request above.

  4. Use that token to create a subscription using our Subscription API, you must use your Sandbox auth(user/pass) which you obtain from the SLA portal.

GET http://msisdn.sla-alacrity.com/purchase?
env=test&
merchant=partner:4e3f654ed86dbb113bb472be07630b3cb6ad0859&
service=campaign:940d351138df895e8dedf51e5d7b90788cdc23d0&
redirect_url=http://test.com/api/callback/123&
correlator=12312-86421-123425
http://test.com/api/callback/123?status=success&
token=TOKEN:1c86724f-b09b-4bed-be8f-4683se8efs34&correlator=12312-86421-123425

Dummy PIN

The PIN API request will always generate the same PIN value which is 000000 as no actual SMS is sent for transactions in the Sandbox.

Once you receive a successful response from PIN API, you can use the PIN 000000 with the subscription API.


What’s Next