FORMAT: 1A HOST: http://polls.apiblueprint.org/
t2-airtime
T2-Airtime is a Ruby gem providing a proxy cache and a REST API to TransferTo Airtime service.
Authorization
- Two Factor Authentication (2FA) is enabled in your TransferTo Shop Security Center section
- You have your Transfer-To Shop username and Airtime secret key generated by 2FA
- Export the secrets as environment variables
T2_SHOP_USER,T2_AIRTIME_KEY
Account
irb(main)> account= T2Airtime::Account.get
irb(main)> T2Airtime::Account.serialize(account.data)
Account Attributes
id(string) - Transfer-To TShop login nametype(string) -Master(main account) orRetailer(subaccount)name(string) - Transfer-To TShop account namecurrency(string) - Account currency (USD, GBP, EUR, etc...)balance(float) - ForMasteraccount returns the account’s remaining balance. ForRetailerreturns the account’s remaining limit balance of the day if a daily limit is fixed. Else, returns the account remaining balancewallet(float) - ForMasterreturns the total remaining balance (sum of all sub-accounts and current master). ForRetailer: 1. If balance is shared and daily limit is fixed: returns the fixed daily limit amount 2. If balance is shared but daily limit is not fixed: returns "No Limit" 3. Else if balance is not shared: returns the remaining balancefetchedAt(string) - The date and time at which the information was fetched
Country
irb(main)> countries= T2Airtime::Country.all
irb(main)> T2Airtime::Country.serialize(countries.data)
Country Attributes
id(integer) - Country Airtime IDname(string) - The country namealpha3(string) - The alpha3 code of the countrycallingCode(float) - The international dialing code of the countryfetchedAt(string) - The date and time at which the information was fetched
Operator
irb(main)> operators= T2Airtime::Operator.all(666)
irb(main)> T2Airtime::Operator.serialize(operators.data)
Operator Attributes
id(integer) - Operator Airtime IDname(string) - The operator namelogo(string) - The URL to the operator logocountryId(float) - The country Airtime ID of the operatorcountryName(float) - The country namecountryAlpha3(float) - The country alpha3fetchedAt(string) - The date and time at which the information was fetched
Operator Relationships
country.id(integer) - Country Airtime ID
Product
irb(main)> products= T2Airtime::Product.all(2361)
irb(main)> T2Airtime::Product.serialize(products.data)
Product Attributes
id(integer) - Product Airtime IDname(string) - The product namelocalCurrency(string) - The currency code of the productlocalCurrencySymbol(string) - The currency symbol of the productcurrency(string) - The curreny of your accountcurrencySymbol(string) - The currency symbol of your accountlocalPrice(float) - The face-value of the topupretailPrice(float) - The retail price of the productwholesalePrice(float) - The wholesale price of the productcountryId(float) - The country Airtime ID of the productcountryName(float) - The country namecountryAlpha3(float) - The country alpha3operatorId(string) - The operator Airtime ID of the productoperatorName(string) - The operator nameoperatorLogo(string) - The URL to the operator logofetchedAt(string) - The date and time at which the information was fetched
Product Relationships
country.id(integer) - Country Airtime IDoperator.id(integer) - Operator Airtime ID
Transaction
irb(main)> transactions= T2Airtime::API.api.transaction_list
irb(main)> T2Airtime::Transaction.serialize(transactions.data)
irb(main)> transaction= T2Airtime::Transaction.get("584171224")
irb(main)> T2Airtime::Transaction.serialize_one(transaction.data)
Transaction Attributes
id(integer) - Transaction Airtime IDmsisdn(string) - The international phone number or name of the user (sender) requesting to credit a phone numberdestinationMsisdn(string) - Destination MSISDN (usually recipient phone number)transactionAuthenticationKey(string) - Authentication key used during the transactiontransactionErrorCode(string) - Error code for the transactiontransactionErrorTxt(string) - Description of the error code for the transactionreferenceOperator(string) - Reference of the operator (returned only if available)actualProductSent(string) - Returns the value requested to the operator (equals to product_requested in case of successful transaction). It equals to 0 when Top-up failed or in a simulation.sms(string) - The custom message appended to the default notification SMS sent to the recipientcid1(string) - Value of the customized field cid1 sent in the Top-up requestcid2(string) - Value of the customized field cid2 sent in the Top-up requestcid3(string) - Value of the customized field cid3 sent in the Top-up requestdate(string) - Date of the transaction (GMT)currency(string) - Currency of the account from which the transaction is requestedlocalCurrency(string) - Currency of the destination countrypinBased(string) - Type of product returned ("Yes", default "No" if not set)localInfoAmount(string) - Final amount received by recipient. Indicative value onlylocalInfoCurrency(string) - Local currency in destinationlocalInfoValue(string) - Value of the transaction before tax and service fee in local currencyerrorCode(string) - Error code for the transactionerrorTxt(string) - Description of the error code for the transactionproductName(string) - The product nameproductLocalCurrency(string) - The currency code of the productproductLocalCurrencySymbol(string) - The currency symbol of the productproductCurrency(string) - The curreny of your accountproductCurrencySymbol(string) - The currency symbol of your accountproductLocalPrice(float) - The face-value of the topupproductRetailPrice(float) - The retail price of the productproductWholesalePrice(float) - The wholesale price of the productcountryId(float) - The country Airtime ID of the productcountryName(float) - The country namecountryAlpha3(float) - The country alpha3operatorId(string) - The operator Airtime ID of the productoperatorName(string) - The operator nameoperatorLogo(string) - The URL to the operator logofetchedAt(string) - The date and time at which the information was fetched
Transaction Relationships
country.id(integer) - Country Airtime IDoperator.id(integer) - Operator Airtime IDproduct.id(integer) - Product Airtime ID
Topup
irb(main)> topup= T2Airtime::API.api.topup params
irb(main)> T2Airtime::Topup.serialize(topup.data)
Topup Attributes
balance(string) - For main account: returns the account’s remaining balance. For sub-account: returns the account’s remaining limit balance of the day if a daily limit is fixed. Else, returns the account remaining balance.balanceDisplay(string) - Thebalancevalue formatted in the currency of your accounttransactionId(integer) - Airtime ID of the transaction.msisdn(string) - The international phone number or name of the user (sender) requesting to credit a phone numberdestinationMsisdn(string) - Destination MSISDN (usually recipient phone number)transactionAuthenticationKey(string) - Authentication key used during the transactiontransactionErrorCode(string) - Error code for the transactiontransactionErrorTxt(string) - Description of the error code for the transactionreferenceOperator(string) - Reference of the operator (returned only if available)actualProductSent(string) - Returns the value requested to the operator (equals to product_requested in case of successful transaction). It equals to 0 when Top-up failed or in a simulation.sms(string) - The custom message appended to the default notification SMS sent to the recipientsmsSent(string) - Defines the status of the notification SMS sent to the recipient. Returnsyesonly if the SMS has been successfully sent.smsText(string) - The custom message appended to the default notification SMS sent to the sender.cid1(string) - Value of the customized field cid1 sent in the Top-up requestcid2(string) - Value of the customized field cid2 sent in the Top-up requestcid3(string) - Value of the customized field cid3 sent in the Top-up requestcurrency(string) - Currency of the account from which the transaction is requestedlocalCurrency(string) - Currency of the destination countryproductName(string) - The product nameproductLocalCurrency(string) - The currency code of the productproductLocalCurrencySymbol(string) - The currency symbol of the productproductCurrency(string) - The curreny of your accountproductCurrencySymbol(string) - The currency symbol of your accountproductLocalPrice(float) - The face-value of the topupproductRetailPrice(float) - The retail price of the productproductWholesalePrice(float) - The wholesale price of the productcountryId(float) - The country Airtime ID of the productcountryName(float) - The country namecountryAlpha3(float) - The country alpha3operatorId(string) - The operator Airtime ID of the productoperatorName(string) - The operator nameoperatorLogo(string) - The URL to the operator logoexecutedAt(string) - The date and time at which the information was fetched
Msisdn
irb(main)> msisdn= T2Airtime::Msisdn.info("+628123456710")
irb(main)> T2Airtime::Msisdn.serialize(msisdn.data)
Msisdn Attributes
msisdn(string) - The international mobile numbercountry(string) - The country of the numbercountryId(string) - Country Airtime IDoperator(string) - The operator of the numberoperatorId(string) - Operator Airtime IDfetchedAt(string) - The date and time at which the information was fetched
Accounts [/accounts]
Cached for 1 hour.
Show Account [GET]
Response 200 (application/json)
{ "type": "accounts", "id": "my-t2-shop-account", "attributes": { "type": "Master", "name": "my-t2-shop-account-name", "currency": "USD", "balance": 16.2, "wallet": 16.2, "fetchedAt": "2017-09-17T13:48:34Z" } }
Countries [/countries]
Cached for 1 hour.
List all Countries [GET]
Response 200 (application/json)
[ { "type": "countries" "id": 661 "attributes": { "name": "Afghanistan" "alpha3": "AFG" "callingCode": "93" "fetchedAt": "2017-09-17T13:58:46Z" } } ... ]
Operators [/operators]
List all Operators [GET]
Cached for 1 hour.
Response 200 (application/json)
[ { "type": "operators" "id": 2361 "attributes": { "name": "Movicel Angola USD" "logo": "https://operator-logo.transferto.com/logo-2361-1.png" "countryId": 666 "countryName": "Angola" "countryAlpha3": "AGO" "fetchedAt": "2017-09-17T16:44:08Z" }, "relationships": { "country": { "data":{ "type": "countries" "id": 666 } } } }, ... ]
Products [/products]
Cached for 1 hour.
List all Products [GET]
Response 200 (application/json)
[ { "type": "products" "id": 1 "attributes": { "name": "$1.00" "localCurrency": "USD" "localCurrencySymbol": "$" "currency": "USD" "currencySymbol": "$" "localPrice": 1.0 "retailPrice": 1.1 "wholesalePrice": 1.03 "countryId": 666 "countryName": "Angola" "countryAlpha3": "AGO" "operatorId": 2361 "operatorName": "Movicel Angola USD" "operatorLogo": "https://operator-logo.transferto.com/logo-2361-1.png" "fetchedAt": "2017-09-17T16:48:20Z" }, "relationships": { "country": { "data": { "type": "countries" "id": 666 } }, "operator": { "data": { "type": "operators" "id": 2361 } } }, ... ]
Transactions [/transactions]
List all Transactions [GET]
Response 200 (application/json)
[ { "type": "transactions" "id": 584176053 "attributes": { "msisdn": "+393800000000" "destinationMsisdn": "393800000001" "transactionAuthenticationKey": "1505553036" "transactionErrorCode": 0 "transactionErrorTxt": "Transaction successful" "referenceOperator": nil "actualProductSent": "5" "sms": nil "smsText": "Test" "cid1": "Cid1" "cid2": "Cid2" "cid3": "Cid3" "date": "2017-09-16 09:10:39" "currency": "USD" "localCurrency": "EUR" "pinBased": "no" "localInfoAmount": "5.00" "localInfoCurrency": "EUR" "localInfoValue": "5.00" "errorCode": 0 "errorTxt": "Transaction successful" "countryId": 772 "countryName": "Italy" "countryAlpha3": "ITA" "operatorId": 734 "operatorName": "Wind Italy" "operatorLogo": "https://operator-logo.transferto.com/logo-734-1.png" "productName": "€5.00" "productLocalCurrency": "EUR" "productLocalCurrencySymbol": "€" "productCurrency": "USD" "productCurrencySymbol": "$" "productLocalPrice": 5.0 "productRetailPrice": 7.5 "productWholesalePrice": 6.9 "fetchedAt": "2017-09-17T16:56:29Z" }, "relationships": { "country": { "data": { "type": "countries" "id": 772 } }, "operator": { "data": { "type": "operators" "id": 734 } }, "product": { "data": { "type": "products" "id": 5 } } } }, ... ]
Show Transactions [GET]
Response 200 (application/json)
{ "type": "transactions" "id": 584176053 "attributes": { "msisdn": "+393800000000" "destinationMsisdn": "393800000001" "transactionAuthenticationKey": "1505553036" "transactionErrorCode": 0 "transactionErrorTxt": "Transaction successful" "referenceOperator": nil "actualProductSent": "5" "sms": nil "smsText": "Test" "cid1": "Cid1" "cid2": "Cid2" "cid3": "Cid3" "date": "2017-09-16 09:10:39" "currency": "USD" "localCurrency": "EUR" "pinBased": "no" "localInfoAmount": "5.00" "localInfoCurrency": "EUR" "localInfoValue": "5.00" "errorCode": 0 "errorTxt": "Transaction successful" "countryId": 772 "countryName": "Italy" "countryAlpha3": "ITA" "operatorId": 734 "operatorName": "Wind Italy" "operatorLogo": "https://operator-logo.transferto.com/logo-734-1.png" "productName": "€5.00" "productLocalCurrency": "EUR" "productLocalCurrencySymbol": "€" "productCurrency": "USD" "productCurrencySymbol": "$" "productLocalPrice": 5.0 "productRetailPrice": 7.5 "productWholesalePrice": 6.9 "fetchedAt": "2017-09-17T16:56:29Z" }, "relationships": { "country": { "data": { "type": "countries" "id": 772 } }, "operator": { "data": { "type": "operators" "id": 734 } }, "product": { "data": { "type": "products" "id": 5 } } } }
Create (Reserve) Transaction [POST]
Response 200 (application/json)
{ "type": "transactions" "id": 584176053 }
Number Information [/msisdn_info]
Cached for 24 hours.
Show Number Information [GET]
Response 200 (application/json)
{ "type": "msisdn" "msisdn": "628123456710" "country": "Indonesia" "countryId": "767" "operator": "AAA-TESTING Indonesia USD" "operatorId": "1562" "fetchedAt": "2017-09-17T17:05:08Z" }
Topup [/topup]
Create Topup [POST]
Response 200 (application/json)
{ "type": "msisdn" "msisdn": "628123456710" "country": "Indonesia" "countryId": "767" "operator": "AAA-TESTING Indonesia USD" "operatorId": "1562" "fetchedAt": "2017-09-17T17:05:08Z" }