Tpay
DOCS

PayPal

PayPal is a global online payment system that allows users to make payments, transfer money, and receive payments over the internet. PayPal operates in many countries and supports various currencies, making it an ideal solution for international transactions.

PayPal transaction

Process PayPal payments using the transaction creation endpoint by providing channelId: 31.

Send a request to create a PayPal transaction

To create a PayPal transaction, send a POST request to the endpoint:

https://api.tpay.com/transactions/

In the request, specify the following parameters:

amount
 *
Transaction amount.
description
 *
Description of the transaction visible to the payer.
payer.email
Payer's email address.
payer.name
Payer's full name.
pay.channelId
Payment channel identifier for PayPal: 31.

* Fields required.

The basic request body should look like this:

{
  "amount": 0.1,
  "description": "Testowa transakcja PayPal",
  "payer": {
    "email": "[email protected]",
    "name": "Jan Nowak"
  },
  "pay": {
    "channelId": 31
  }
}

Example:

curl --location 'https://api.tpay.com/transactions' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
   "amount": 0.1,
   "description": "Testowa transakcja PayPal",
   "payer": {
      "email": "[email protected]",
      "name": "Jan Nowak"
   },
   "pay": {
      "channelId": 31
   }
}'

After sending the request, you will receive a TransactionCreated schema in the response.

The key response parameters are:

result
success - The transaction was successfully created.
status
pending - The transaction is awaiting payment.
transactionId
Unique transaction identifier.
transactionPaymentUrl
URL to redirect the payer to.
Note

Store the transactionId parameter in your system. More about transactionId.

Redirect the payer to the transaction panel

Redirect the payer to the URL contained in the response in the transactionPaymentUrl field.

Then, the payer logs into their PayPal account and completes the transaction.

Payer is redirected to success or error page

When the PayPal payment is completed, the payer is redirected to a success page or error page depending on whether the transaction was successful.

Handle notification

We will notify you of the transaction status via transaction posting notifications.