Initiate Transaction
note
You can use testPartnerId
as your partnerId and testPrivateKey
as your API Key for
testing purposes.
warning
Never share your API Keys with anyone. Anyone with the API Key will be able to create transactions on your behalf. It should reside solely on your servers.
- Request
- Response
POST https://web.bharatx.tech/api/transaction
Headers:Content-Type: application/jsonX-Signature: Base-64 encoded SHA256 hash of request body + request URL without https:// and domain name (For example, in http://example.org/api/example1/?a=b, you should consider only /api/example1/?a=b) + privateApiKey.X-Partner-Id: partnerId
Body:{ "id": "txnId01", // unique "amount": 10000, // in paise "user": { "name": "string", "phoneNumber": "string", // of the format +91xxxxxxxxxx "email": "string" }, // optional "redirect": { // optional - the URL to redirect user to after transaction completion. // By default, this will be your homepage URL "url": "string", // optional - The logo URL to use instead of your default logo // (don't use this unless necessary) "logoOverride": "string", // optional - The hex color of the format \#xxxxxx to use instead of // your default hex color (don't use this unless necessary) "colorOverride": "string" // optional - the URL to redirect user to after transaction faliure or non eligibility // By default, this will not be enabled "failureUrl": "string" }}
Headers:-
Status = 200: Successfully created the transaction
Body:{ "message": string, // will only be present if you supply "redirect" params in the request "redirectUrl": string}
Status = 400: Bad RequestStatus = 401: Failed to authorize youStatus = 5xx: Unknown failure
Body:{ "message": string}