Mobile Phone Credits

Recharge your phone credits using the Wallet balance.

❗️

API Deprecation Notice

This feature is changing, the interfaces described here are deprecated starting at v2.1.5 and will be upgraded soon. Some breaking changes may be required to keep the systems operating properly.

To perform the purchase of the mobile phone credits using the Wallet balance, you must use three endpoints in order. You can find some examples here.


Available Providers

This endpoint doesn't have parameter. It will return a list of available phone providers for recharge with their code. If the consumer's phone provider is not in the list, the platform won't be able to perform the recharge. You can see below one response example.


**GET /phone-credits/providers**

The response will be the available phone carrier providers for recharging mobile credits.

{
  "dealers": [
    {
      "code": "001",
      "name": "Vivo"
    },
    {
      "code": "002",
      "name": "Claro"
    },
    {
      "code": "003",
      "name": "Oi"
    },
    {
      "code": "004",
      "name": "Tim"
    }
  ]
}

Creating a new Order

You must insert the phone number, country code and the provider code that you retrieved from the first endpoint.


**POST /phone-credits/order/create**

The response will be an Order in "preview mode", not yet confirmed, with an ID which you will need to use to complete the operation and a list of possible amounts.

{
  "id": "98291601-80aa-4082-ba6d-bf92621fe9c7",
  "providerCode": "001",
  "phoneNumber": "996416288",
  "phoneCode": "19",
  "providerOrderId": "4c023bf5-0ffe-40c8-a99d-e5feeb47de65",
  "status": "created",
  "amounts": [
    {
      "id": "c292d94e-631c-4948-b368-b0b39f06ce7f",
      "deletedAt": null,
      "createdAt": "2019-07-17T12:42:09.171Z",
      "updatedAt": "2019-07-17T12:42:09.171Z",
      "amount": "500",
      "amountKey": ""
    },
    {
      "id": "61df99af-da6a-4e87-9c10-98ea5610662d",
      "deletedAt": null,
      "createdAt": "2019-07-17T12:42:09.184Z",
      "updatedAt": "2019-07-17T12:42:09.184Z",
      "amount": "3000",
      "amountKey": ""
    }
 ],
  "deletedAt": null,
  "createdAt": "2019-07-17T12:42:09.158Z",
  "updatedAt": "2019-07-17T12:42:09.158Z",
  "walletId": null,
  "chosenAmount": null,
}

Completing your Order

You must insert the Id provided and the amount chosen from the last endpoint. This endpoint will perform the phone charge and remove the assets from the consumer wallet.


POST /phone-credits/order/:orderId/complete

🚧

Important Notice - Amount Conversion

Due to provider restrictions, the amount given by the 'create order' endpoint is in Brazilian cents format, but the amount requested by the complete endpoint is in BRLD. This means you must divide by 100 the amount chosen before sending to the 'complete order' endpoint.

The response will be the Transaction associated with the completed Phone Credits Order.


Did this page help you?