MITE (TEST) API URL:
https://api.mite.pay360.com
LIVE API URL:
https://api.pay360.com
There’s multiple ways to get the token, first would be a server-to-server call to the Advanced Payments API, then sent to the mobile app with your own API. However, if your backend is not ready yet or you just want to test the functionality of the Mobile SDK, you can temporarily use our backed in method available at com.accesspaysuite.mobilesdk.utils.AuthenticationHelper
to test the functionality of the library. The use of the AuthenticationHelper must not exceed the TEST/MITE Environment as it requires the raw credentials (username, password) in order to generate an authentication token for you and those cannot be completely and efficiently obfuscated to guarantee a secure environment for your app and credentials.
Get Authentication Token (API)
To obtain an authentication token using the Advanced Payments API, you need to make a POST request to the following endpoint:
acceptor/rest/authorisation/{{instId}}/authoriseClient
Request
Headers
Include the following header in your request:
Authorization: Basic base64(username:password)
Body
For customer payments, include the following JSON body in your request:
{
"scopes": [
"MOBILE_CUSTOMER_PAYMENT"
],
"customerReference": "CUST_000001"
}
The customerReference
should be unique to the specific customer
For guest payments, include the following JSON body in your request:
{
"scopes": [
"MOBILE_GUEST_PAYMENT"
]
}
Response
{
"clientToken": "YOUR_CLIENT_TOKEN",
"status": "S100",
"message": "OK",
"expires": "2024-09-11T14:16:19.000Z"
}
The clientToken
will be used in the PaymentConfig
.
Guest Customer
For guest customers, the customerReference
field should be null in the request body. The payment will be processed as a guest user.
Remember to replace {{instId}}
with the actual installation identifier.
Get Authentication Token (Helper)
Using the MobileSDK’s class AuthenticationHelper
/**
* Async Helper method to retrieve Authorization Credentials (Client Token) for
* Advanced Payments Platform (AP)
*
* The customer reference must be the unique reference of the customer and will
* be used to manage the customer's payment methods and other details.
*
* The customer reference can be null if the guestPayment flag is set to true.
*
* The guest payment flag is used to process the payment as a guest user.
* Making the payment as guest it will not store any customer details.
*
* @param environment The environment to use for the request
* @param instId The installation ID
* @param userName The API username
* @param password The API password
* @param customerReference The customer reference (nullable)
* @param guestPayment The guest payment flag (false/true)
*
* @return The Authentication Token (Client Token) as a string
*/
@Throws(AuthorizationException::class, CancellationException::class)
suspend fun requestAuthToken(
environment: Environment,
instId: String,
userName: String,
password: String,
customerReference: String?,
guestPayment: Boolean
): String