Create a transaction in the Direct Pay Online system and receive a transaction token for the payment page.
createToken (v6)
Create a transaction in the Direct Pay Online system and receive a transaction token that can be used to send the customer to the payment page.
The createToken request is built from the request wrapper and five data levels:
- Transaction level — Mandatory. Contains the basic transaction information.
- Services level — Mandatory. Contains information about the services sold in the transaction. You must send at least one service.
- Allocations level — Optional. Contains information about allocating money from the transaction to other providers in the Direct Pay Online system. If you do not send this level, the full transaction amount is allocated to the provider.
- Additional level — Optional. Blocks specific payment options for the transaction. For example, an application that needs fast payment can block Direct Pay Online bank payment.
- Travelers level — Optional. Contains traveler, passenger, or guest information used by Direct Pay Online to verify that one payer name matches one traveler name.
Legacy note:
Some fields and endpoints may still reference 3G Direct Pay (3G).
This is the same platform, now branded as DPO Pay by Network.
Endpoint
Method: POST
URL:
https://secure.3gdirectpay.com/API/v6/Headers:
Content-Type: application/xml; charset=utf-8
Accept: application/xmlRequest fields
Send these fields at the root level of the XML request.
| Parameter | Data type | Description | Required |
|---|---|---|---|
CompanyToken | Token | Token you received from 3G to operate this API. | Mandatory |
Request | Text | Must be createToken. | Mandatory |
Transaction level
Wrap transaction fields in a Transaction tag. The transaction level is mandatory.
<Transaction>
<PaymentAmount>300</PaymentAmount>
<PaymentCurrency>tzs</PaymentCurrency>
<CompanyRefUnique>1</CompanyRefUnique>
<CompanyRef>YourRef12345</CompanyRef>
<OriginatorSourceID>8777250772</OriginatorSourceID>
<OrderNumber>735487493</OrderNumber>
<PTL>56</PTL>
<customerFirstName>John</customerFirstName>
<customerLastName>Doe</customerLastName>
<customerEmail>[email protected]</customerEmail>
<DefaultPayment>MO</DefaultPayment>
<DefaultPaymentCountry>Tanzania</DefaultPaymentCountry>
<DefaultPaymentMNO>Tigo</DefaultPaymentMNO>
<TransactionSource>Mobile</TransactionSource>
<MetaData>
<![CDATA[
{
"key": "Value"
}
]]>
</MetaData>
</Transaction>Transaction fields
| Parameter | Data type | Description | Required |
|---|---|---|---|
PaymentAmount | Money | Total amount in the selected currency. Use no more than 2 digits after the comma. | Mandatory |
PaymentCurrency | Text | Currency from the table of options accepted by DPO. | Mandatory |
CompanyRef | Text | Company reference number, also referred to as the booking reference. | Optional |
OriginatorSourceID | Text (15 bytes) | Third-party unique transaction identifier. | Optional |
OrderNumber | Text (15 bytes) | Merchant order reference number. | Optional |
RedirectURL | Text | URL to redirect the customer after payment. The customer is redirected to this URL using the GET method with TransID, CCDapproval, PnrID, TransactionToken, and CompanyRef. If you include additional variables in your URL, the system appends the DPO variables with & instead of starting with ?. | Optional |
BackURL | Text | URL that lets the customer go back from the payment page. The customer is redirected to this URL using the GET method with TransactionToken and CompanyRef. If you include additional variables in your URL, the system appends the DPO variables with & instead of starting with ?. | Optional |
CompanyRefUnique | Boolean | Tells the system to check whether the company reference number, also referred to as the transaction ID given by the provider, already exists and is paid. If it does, the API returns an error. This prevents double payments. Default: False. | Optional |
PTL | Number | Number of hours for the payment time limit. Default: 96 hours. | Optional |
PTLtype | Text | Defines whether the PTL tag is measured in hours or minutes. Default: hours. | Optional |
TransactionChargeType | Number | Type of transaction. Use 1 for Charge, which is an immediate charge; 2 for Authorize-Manual, which authorizes the transaction and requires a manual charge using chargeToken; or 3 for Authorize-Auto, which authorizes the transaction and automatically charges it on the selected date. Default: 1 (Charge). | Optional |
TransactionAutoChargeDate | DateTime | Date and time for automatic charging of the transaction, if authorized by that date. Supported formats: YYYY/MM/DD HH:MM(:SS), YYYY/MM/DD, YYYY-MM-DD HH:MM(:SS), and YYYY-MM-DD. | Optional. Mandatory if TransactionChargeType is Authorize-Auto. |
customerEmail | Text | Customer email address used to send the payment link. | Optional |
customerFirstName | Text | Customer first name. | Optional |
customerLastName | Text | Customer last name. | Optional |
customerAddress | Text | Customer address. | Optional |
customerCity | Text | Customer city. | Optional |
customerCountry | ISO code | Customer country ISO 2-letter code. See http://en.wikipedia.org/wiki/ISO_3166-1. | Optional |
customerDialCode | ISO code | Customer country ISO 2-letter code. | Optional |
customerPhone | Number | Customer phone number. | Optional |
customerZip | Text | Customer ZIP code. | Optional |
DemandPaymentbyTraveler | Boolean (1/0) | If set to 1, the system requires one of the travelers included in the Travelers tag to be the payer. | Optional |
EmailTransaction | Boolean (1/0) | If set to 1, the system sends the customer an email about the transaction with a link to pay. | Optional |
CompanyAccRef | Text | Internal accounting reference number. | Optional |
userToken | Token | Defines who created the transaction. | Optional |
DefaultPayment | Text | Code of the default payment option to display first on the payment page. Options: CC for credit card, MO for mobile, PP for PayPal, BT for bank transfer, and XP for xPay. | Optional |
DefaultPaymentCountry | Text | Use only for mobile default payment. Sets the default country for the payment option. DefaultPayment also works without this field. Example: <DefaultPaymentCountry>kenya</DefaultPaymentCountry>. | Optional |
DefaultPaymentMNO | Text | Use only for mobile default payment. Sets the default MNO (mobile network operator) for the payment option. DefaultPayment also works without this field. Example: <DefaultPaymentMNO>mpesa</DefaultPaymentMNO>. | Optional |
TransactionToPrep | Boolean (1/0) | Marks the transaction as Marketplace Prep. | Optional |
AllowRecurrent | Boolean (1/0) | Allows payment by recurrent payment. | Optional |
FraudTimeLimit | Number | Sets the fraud time limit in minutes from the current date. | Optional |
Voidable | Boolean (1/0) | If this tag is sent, the transaction is checked in the scoring process. If set to 0 and scoring is high risk or very high risk, the transaction is blocked. If set to 1, the transaction goes to the DPO support team for review. | Optional |
ChargeType | Text | Charge type. | Optional |
TRANSmarketplace | Number | If sent, the allocation amount is updated based on the API_GetCCTclientprecentage stored procedure. | Optional |
TRANSblockCountries | Boolean (1/0) | Transaction block countries. | Optional |
MetaData | Text (2000) | Custom data to store for the transaction. Maximum length: 2000 symbols. | Optional |
SMSTransaction | Boolean (1/0) | SMS transaction. | Optional |
TransactionType | Text | If set, updates the transaction status ID based on this value. | Optional |
DeviceId | Text | Used if the transaction type is Duma Directpay. | Optional |
DeviceCountry | Text | Used if the transaction type is Duma Directpay. | Optional |
TransactionSource | Text | Indicates the source of the transaction. If omitted, the default source is applied. Default: API. Available sources include Computer, Mobile, API, Website, Catalogue, Realtime Settlement, DPO Card, DPO Store, Lite Portal, Marketplace, Pay My Bills, Shopify, Wordpress, Magento, Whcms, Wix, Ecwid, Android SDK, IOS SDK, DPO Pay mobile Android, DPO Pay mobile IOS, POS, and sPOS. | Optional |
Services level
Wrap services in a Services tag and each individual service in a Service tag. The services level is mandatory, and there is no limit on the number of individual services you can send in the Services tag.
<Services>
<Service>
<ServiceType>33</ServiceType>
<ServiceDescription>Service number 1</ServiceDescription>
<ServiceDate>2018/01/20 19:00</ServiceDate>
</Service>
<Service>
<ServiceType>39</ServiceType>
<ServiceDescription>Service number 2</ServiceDescription>
<ServiceDate>2018/01/20 19:00</ServiceDate>
<ServiceFrom>JFK</ServiceFrom>
<ServiceTo>CDG</ServiceTo>
</Service>
<Service>
<ServiceTypeName>Commission</ServiceTypeName>
<ServiceDescription>Service number 2</ServiceDescription>
<ServiceDate>2018/01/20 19:00</ServiceDate>
<ServiceFrom>JFK</ServiceFrom>
<ServiceTo>CDG</ServiceTo>
</Service>
</Services>Service fields
| Parameter | Data type | Description | Required |
|---|---|---|---|
ServiceDescription | Text | Description of the payment made. | Mandatory |
ServiceType | Number | Service type number according to the options accepted by DPO. | Mandatory-Optional. Send either ServiceType or ServiceTypeName. |
ServiceTypeName | Text | Service type name according to the options accepted by DPO. | Mandatory-Optional. Send either ServiceType or ServiceTypeName. |
ServiceDate | DateTime | Service date of the booked service. Format: YYYY/MM/DD HH:MM. | Mandatory |
ServiceFrom | IATA | 3-letter departure airport code. | Optional |
ServiceTo | IATA | 3-letter destination airport code. | Optional |
ServiceRef | Text | Service reference. | Optional |
Allocations level
Wrap allocations in an Allocations tag and each allocation in an Allocation tag. The limit for an allocation is 89% of the total transaction amount. Some fields are mandatory for each allocation sent.
<Allocations>
<Allocation>
<AllocationCode>demo1</AllocationCode>
<AllocationAmount>130.00</AllocationAmount>
<AllocationServiceType>39</AllocationServiceType>
</Allocation>
<Allocation>
<AllocationCode>demo2</AllocationCode>
<AllocationAmount>40.00</AllocationAmount>
<AllocationServiceType>33</AllocationServiceType>
<AllocationServiceDescription>Description of the allocation</AllocationServiceDescription>
</Allocation>
</Allocations>Allocation fields
| Parameter | Data type | Description | Required |
|---|---|---|---|
AllocationCode | Text | Code of the other provider to allocate money to. | Mandatory |
AllocationAmount | Money | Allocated amount. | Mandatory |
AllocationServiceType | Number | Allocation service type from the list of services. | Mandatory |
AllocationServiceDescription | Text | Free text. | Optional |
AllocationInvoice | Text | Invoice of the allocation. | Optional |
AllocationPnr | Text | PNR of the allocation. | Optional |
AllocationBlock | Boolean (1/0) | Insert into API_CreateToken_additional_insert. | Optional |
Additional level
Wrap additional information in an Additional tag and each blocked payment option in a BlockPayment tag.
Additional fields
| Parameter | Data type | Description | Required |
|---|---|---|---|
BlockPayment | Text | Code of the payment option to block. Options: CC for credit card, MO for mobile, PP for PayPal, BT for bank transfer, XP for xPay, SE for SID-EFT, and CP for USSD (Coral Pay). | Optional |
Travelers level
Wrap travelers in a Travelers tag and each traveler in a Traveler tag. Some fields are mandatory for each traveler sent.
<Travelers>
<Traveler>
<TravelerFirstName>John</TravelerFirstName>
<TravelerLastName>Doe</TravelerLastName>
<TravelerPhone>12312312</TravelerPhone>
<TravelerPhonePrefix>254</TravelerPhonePrefix>
</Traveler>
<Traveler>
<TravelerFirstName>Rose</TravelerFirstName>
<TravelerLastName>Doe</TravelerLastName>
</Traveler>
</Travelers>Traveler fields
| Parameter | Data type | Description | Required |
|---|---|---|---|
TravelerFirstName | Text | First name. | Mandatory |
TravelerLastName | Text | Last name. | Mandatory |
TravelerPhone | Text | Phone number. | Optional |
TravelerPhonePrefix | Numeric | Phone number prefix without +. | Optional |
Request examples
Simple one-service transaction
In this type of transaction, the customer is redirected to the RedirectURL after payment.
<?xml version="1.0" encoding="utf-8"?>
<API3G>
<CompanyToken>57466282-EBD7-4ED5-B699-8659330A6996</CompanyToken>
<Request>createToken</Request>
<Transaction>
<PaymentAmount>450.00</PaymentAmount>
<PaymentCurrency>USD</PaymentCurrency>
<CompanyRef>49FKEOA</CompanyRef>
<RedirectURL>http://www.domain.com/payurl.php</RedirectURL>
<BackURL>http://www.domain.com/backurl.php</BackURL>
<CompanyRefUnique>0</CompanyRefUnique>
<PTL>5</PTL>
</Transaction>
<Services>
<Service>
<ServiceType>45</ServiceType>
<ServiceDescription>Flight from Nairobi to Diani</ServiceDescription>
<ServiceDate>2013/12/20 19:00</ServiceDate>
</Service>
</Services>
</API3G>Two services with allocation, travelers, and email alert
This example does not define a redirect URL or back URL because the transaction is completed on the DPO website.
<?xml version="1.0" encoding="utf-8"?>
<API3G>
<CompanyToken>57466282-EBD7-4ED5-B699-8659330A6996</CompanyToken>
<Request>createToken</Request>
<Transaction>
<PaymentAmount>950.00</PaymentAmount>
<PaymentCurrency>USD</PaymentCurrency>
<CompanyRef>49FKEOA</CompanyRef>
<RedirectURL></RedirectURL>
<BackURL></BackURL>
<CompanyRefUnique>0</CompanyRefUnique>
<PTL>5</PTL>
<customerEmail>[email protected]</customerEmail>
<FraudTimeLimit>60</FraudTimeLimit>
</Transaction>
<Services>
<Service>
<ServiceType>45</ServiceType>
<ServiceDescription>Flight from Nairobi to Diani</ServiceDescription>
<ServiceDate>2013/12/20 19:00</ServiceDate>
</Service>
<Service>
<ServiceType>45</ServiceType>
<ServiceDescription>Flight from Diani to Wilson</ServiceDescription>
<ServiceDate>2013/12/25 09:00</ServiceDate>
</Service>
</Services>
<Allocations>
<Allocation>
<AllocationCode>demo1</AllocationCode>
<AllocationAmount>850</AllocationAmount>
<AllocationServiceType>45</AllocationServiceType>
</Allocation>
</Allocations>
<Travelers>
<Traveler>
<TravelerFirstName>John</TravelerFirstName>
<TravelerLastName>Doe</TravelerLastName>
<TravelerPhone>456887014</TravelerPhone>
<TravelerPhonePrefix>254</TravelerPhonePrefix>
</Traveler>
<Traveler>
<TravelerFirstName>Rose</TravelerFirstName>
<TravelerLastName>Doe</TravelerLastName>
</Traveler>
</Travelers>
</API3G>Simple one-service transaction with blocked payment options
<?xml version="1.0" encoding="utf-8"?>
<API3G>
<CompanyToken>57466282-EBD7-4ED5-B699-8659330A6996</CompanyToken>
<Request>createToken</Request>
<Transaction>
<PaymentAmount>950.00</PaymentAmount>
<PaymentCurrency>USD</PaymentCurrency>
<CompanyRef>49FKEOA</CompanyRef>
<RedirectURL>http://www.domain.com/payurl.php</RedirectURL>
<BackURL>http://www.domain.com/backurl.php</BackURL>
<CompanyRefUnique>0</CompanyRefUnique>
<PTL>5</PTL>
</Transaction>
<Services>
<Service>
<ServiceType>45</ServiceType>
<ServiceDescription>Flight from Nairobi to Diani</ServiceDescription>
<ServiceDate>2013/12/20 19:00</ServiceDate>
</Service>
</Services>
<Additional>
<BlockPayment>BT</BlockPayment>
<BlockPayment>PP</BlockPayment>
</Additional>
</API3G>AdditionalAirlineFields
Use AdditionalAirlineFields to send additional transaction properties for airline transactions.
| Parameter | Data type | Description | Required |
|---|---|---|---|
AdditionalAirlineFields | XML (String) | Additional transaction properties. | Optional |
AdditionalAirlineFields parameters
| Parameter | Data type | Description | Required |
|---|---|---|---|
TicketType | Text | Ticket type. | Optional |
DocumentType | Text | Document type. | Optional |
DateIssued | DateTime | Date issued. | Mandatory |
IATACarrierCode | Text | IATA carrier code. | Mandatory |
IATATravelAgencyNbr | Text | IATA travel agency number. | Optional |
TicketCarrierName | Text | Ticket carrier name. | Optional |
TicketIssuerCityName | Text | Ticket issuer city name. | Optional |
PassengerCount | Numeric | Number of passengers. | Optional |
ConjTicketIndicator | Text | Conjunction ticket indicator. | Optional |
ElecTicketIndicator | Text | Electronic ticket indicator. | Optional |
TicketNumber | Text | Exchanged/original ticket number or PNR. | Mandatory |
FlightLegDetails | XML (String) | Flight leg details. | Optional |
Travelers | XML (String) | Traveler details. | Optional |
AdditionalAirlineFields traveler parameters
| Parameter | Data type | Description | Required |
|---|---|---|---|
TravelerFirstName | Text | First name. | Mandatory |
TravelerLastName | Text | Last name. | Mandatory |
TravelerPhone | Text | Phone number. | Optional |
TravelerPhonePrefix | Numeric | Phone number prefix without +. | Optional |
TravelerDateOfBirth | DateTime | Traveler date of birth. | Optional |
TravelerCountryCode | Text | Traveler country code. | Optional |
Flight leg parameters
| Parameter | Data type | Description | Required |
|---|---|---|---|
FlightDescription | Text | Description of the payment made. | Mandatory |
FlightType | Number | Service type number according to the options accepted by DPO. | Mandatory |
FlightDate | DateTime | Service date of the booked service. Format: YYYY/MM/DD HH:MM. | Mandatory |
FlightFrom | Text | 3-letter departure airport code. | Mandatory |
FlightTo | Text | 3-letter destination airport code. | Mandatory |
FlightRef | Text | Service reference. | Optional |
CarrierCode | Text | IATA carrier code. | Mandatory |
ServiceClass | Text | Service class. | Mandatory |
FlightNumber | Text | Flight number. | Mandatory |
FareBasisCode | Text | Fare basis code. | Mandatory |
StopOverCode | Text | Stopover code. | Mandatory |
AdditionalAirlineFields request example
<API3G>
<CompanyToken>90EC1DA4-A7C5-432C-930C-098715D3130E</CompanyToken>
<Request>createToken</Request>
<Transaction>
<PaymentAmount>3.00</PaymentAmount>
<PaymentCurrency>USD</PaymentCurrency>
<CompanyRef>tr11212bnbv</CompanyRef>
<CompanyRefUnique>0</CompanyRefUnique>
<PTL>100000</PTL>
<CompanyAccRef>www</CompanyAccRef>
<PTLtype>minutes</PTLtype>
<DefaultPayment>XP</DefaultPayment>
<AllowRecurrent></AllowRecurrent>
<customerFirstName>Dima</customerFirstName>
<customerLastName>Kyselov</customerLastName>
<customerCity>Nairobddi</customerCity>
<customerCountry>KE</customerCountry>
<CardHolderName>Dimdad Kyselovfd</CardHolderName>
<customerEmail>[email protected]</customerEmail>
<customerPhone>789564545</customerPhone>
<DefaultPaymentCountry>Israel</DefaultPaymentCountry>
</Transaction>
<Services>
<Service>
<ServiceType>6456</ServiceType>
<ServiceDescription>Airlines Service</ServiceDescription>
<ServiceDate>2020/05/12</ServiceDate>
</Service>
</Services>
<AdditionalAirlineFields>
<TicketType>TICKET_PURCHASE</TicketType>
<DocumentType>ADDITIONAL_COLLECTION</DocumentType>
<DateIssued>2013/12/20 19:00</DateIssued>
<IATACarrierCode>CP</IATACarrierCode>
<IATATravelAgencyNbr>CPT</IATATravelAgencyNbr>
<TicketCarrierName>KenyaAirways</TicketCarrierName>
<TicketIssuerCityName>Nairobi</TicketIssuerCityName>
<PassengerCount>3</PassengerCount>
<ConjTicketIndicator>12233</ConjTicketIndicator>
<ElecTicketIndicator>1A848F</ElecTicketIndicator>
<ExchTicketIndicator>1A848E5</ExchTicketIndicator>
<FlightLegDetails>
<FlightLeg>
<FlightDescription>Flight from TelAviv to CapeTown</FlightDescription>
<FlightType>45</FlightType>
<FlightDate>2013/12/20</FlightDate>
<FlightFrom>TLV</FlightFrom>
<FlightTo>CPT</FlightTo>
<FlightRef>1234ABC</FlightRef>
<CarrierCode>AI</CarrierCode>
<ServiceClass>A</ServiceClass>
<FlightNumber>101</FlightNumber>
<FareBasisCode>SPRSVR</FareBasisCode>
<StopOverCode>X</StopOverCode>
</FlightLeg>
<FlightLeg>
<FlightDescription>Flight from CapeTown to TelAviv</FlightDescription>
<FlightType>45</FlightType>
<FlightDate>2013/12/21 16:00</FlightDate>
<FlightFrom>CPT</FlightFrom>
<FlightTo>TLV</FlightTo>
<FlightRef>1234ABC</FlightRef>
<CarrierCode>AI</CarrierCode>
<ServiceClass>A</ServiceClass>
<FlightNumber>101</FlightNumber>
<FareBasisCode>SPRSVR</FareBasisCode>
<StopOverCode>X</StopOverCode>
</FlightLeg>
</FlightLegDetails>
<Travelers>
<Traveler>
<TravelerFirstName>John</TravelerFirstName>
<TravelerLastName>Doe</TravelerLastName>
<TravelerPhone>45640404</TravelerPhone>
<TravelerPhonePrefix>123</TravelerPhonePrefix>
<TravelerDateOfBirth>2001/12/21</TravelerDateOfBirth>
<TravelerCountryCode>US</TravelerCountryCode>
</Traveler>
<Traveler>
<TravelerFirstName>Rose</TravelerFirstName>
<TravelerLastName>Doe</TravelerLastName>
</Traveler>
</Travelers>
</AdditionalAirlineFields>
</API3G>Response
The method responds with the result of your request.
Response fields
| Parameter | Data type | Description |
|---|---|---|
Result | 3-digit code | Code sent with the result of the request. |
ResultExplanation | Text | Free text result explanation. |
TransToken | Text | Transaction token, if the transaction was created. |
TransRef | Text | Transaction reference, if the transaction was created. |
notes | Text | Request notes, if any. |
AllocationID | Number | xPay ID when there is an allocation in the transaction. |
AllocationCode | Text | Receiver merchant code. |
Payment page URL:
https://secure.3gdirectpay.com//payv2.php?ID={{TransToken}}Example:
https://secure.3gdirectpay.com//payv2.php?ID=72983CAC-5DB1-4C7F-BD88-352066B71592
Response codes
| Code | Explanation |
|---|---|
000 | Transaction created. |
801 | Request missing company token. |
802 | Company token does not exist. |
803 | No request or error in request type name. |
804 | Error in XML. |
901 | Error: maximum string size allowed. |
902 | Request missing transaction-level mandatory fields: name of field. |
904 | Currency not supported. |
905 | The transaction amount has exceeded your allowed transaction limit. Contact [email protected]. |
906 | You exceeded your monthly transaction limit. Contact [email protected]. |
922 | Provider does not exist. |
923 | Allocated money exceeds payment amount. |
930 | Block payment code incorrect. |
940 | CompanyRef already exists and is paid. |
950 | Request missing mandatory fields: name of field, or request fields are empty. |
960 | Tag has been sent multiple times. |
Success response example
<?xml version="1.0" encoding="utf-8"?>
<API3G>
<Result>000</Result>
<ResultExplanation>Transaction created</ResultExplanation>
<TransToken>72983CAC-5DB1-4C7F-BD88-352066B71592</TransToken>
<TransRef>1285DB12G</TransRef>
<Allocations>
<Allocation>
<AllocationID>95746</AllocationID>
<AllocationCode>f8g</AllocationCode>
</Allocation>
</Allocations>
</API3G>Error response example
<?xml version="1.0" encoding="utf-8"?>
<API3G>
<Result>920</Result>
<ResultExplanation>Request missing mandatory allocation field AllocationCode</ResultExplanation>
</API3G>
