> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.epaygames.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.epaygames.io/_mcp/server.

# Generate Transaction

POST https://api-stg.epaygames.io/v1/biller/transactions/generate
Content-Type: application/json

### Generate Transaction

The **Generate Transaction** endpoint creates a web payment link for a specific payment channel. You can redirect your customer to this link so they can complete the payment.

After the payment is processed, the user will be **automatically redirected** to either the `success_redirect_url` or the `failure_redirect_url`, depending on whether the payment was successful.

To receive real-time payment updates, you may use the `callback_webhook_url`, which will notify your system once the payment status is confirmed.

**Response Fields:**

- `status` — starts as `pending`; final values are `completed` or `cancelled`.
- `provider_reference_no` — the upstream provider reference number; may be `null` or a string.
- `other_reference_no` — an additional reference number; may be `null` or a string.

Reference: https://docs.epaygames.io/payments-api/generate-transaction

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: payments
  version: 1.0.0
paths:
  /v1/biller/transactions/generate:
    post:
      operationId: Generate Transaction
      summary: Generate Transaction
      description: >-
        ### Generate Transaction


        The **Generate Transaction** endpoint creates a web payment link for a
        specific payment channel. You can redirect your customer to this link so
        they can complete the payment.


        After the payment is processed, the user will be **automatically
        redirected** to either the `success_redirect_url` or the
        `failure_redirect_url`, depending on whether the payment was successful.


        To receive real-time payment updates, you may use the
        `callback_webhook_url`, which will notify your system once the payment
        status is confirmed.


        **Response Fields:**


        - `status` — starts as `pending`; final values are `completed` or
        `cancelled`.

        - `provider_reference_no` — the upstream provider reference number; may
        be `null` or a string.

        - `other_reference_no` — an additional reference number; may be `null`
        or a string.
      tags:
        - ''
      parameters:
        - name: Authorization
          in: header
          description: >-
            Bearer token obtained from the Create Token endpoint. Tokens are
            valid for ~60 minutes — cache and reuse a token for its full
            lifetime instead of re-authenticating per request.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Generate Transaction_Response_200'
        '401':
          description: Unauthorized — missing, invalid, or expired bearer token.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostV1BillerTransactionsGenerateRequestUnauthorizedError
        '422':
          description: >-
            Unprocessable Entity — validation failed on the request payload.
            `errors` is keyed by field name, each holding an array of messages.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostV1BillerTransactionsGenerateRequestUnprocessableEntityError
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                channel_code:
                  type: string
                  description: >-
                    The payment channel to use. Values are available via the Get
                    Channels endpoint — refer to the `code` field in its
                    response.
                amount:
                  type: number
                  format: double
                  description: Amount to collect. Must be between 0.01 and 50,000.
                reference_no:
                  type: string
                  description: >-
                    Your unique reference for this transaction. Each
                    `reference_no` can be used only once, making it a natural
                    idempotency key — reuse the same value when retrying the
                    same intent. See the Idempotency & Safe Retries guide.
                success_redirect_url:
                  type: string
                  format: uri
                  description: >-
                    Optional. Where the customer's browser is redirected after a
                    successful payment.
                failure_redirect_url:
                  type: string
                  format: uri
                  description: >-
                    Optional. Where the customer's browser is redirected if the
                    payment fails or is cancelled.
                callback_webhook_url:
                  type: string
                  format: uri
                  description: >-
                    Optional but strongly recommended. URL that receives a
                    server-side webhook once the final payment status is known.
                    See the Webhooks & Redirects guide.
              required:
                - channel_code
                - amount
                - reference_no
servers:
  - url: https://api.epaygames.io
    description: Production
  - url: https://api-stg.epaygames.io
    description: Staging/Sandbox
components:
  schemas:
    V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataStatus:
      type: string
      enum:
        - pending
        - completed
        - cancelled
      title: >-
        V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataStatus
    V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataCurrency:
      type: object
      properties:
        name:
          type: string
        code:
          type: string
        symbol:
          type: string
      required:
        - name
        - code
        - symbol
      title: >-
        V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataCurrency
    V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataChannelCategory:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        slug:
          type: string
      required:
        - name
        - description
        - slug
      title: >-
        V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataChannelCategory
    V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataChannel:
      type: object
      properties:
        name:
          type: string
        desciption:
          description: Any type
        instruction:
          type: string
        slug:
          type: string
        code:
          type: string
        logo:
          type: string
        category:
          $ref: >-
            #/components/schemas/V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataChannelCategory
      required:
        - name
        - instruction
        - slug
        - code
        - logo
        - category
      title: >-
        V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataChannel
    V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        subtotal_amount:
          type: number
          format: double
        service_fee:
          type: integer
        total_amount:
          type: number
          format: double
        reference_no:
          type: string
        provider_reference_no:
          description: Any type
        other_reference_no:
          description: Any type
        status:
          $ref: >-
            #/components/schemas/V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataStatus
        barcode_url:
          description: Any type
        qrcode_url:
          description: Any type
        link_url:
          description: Any type
        is_web_payment:
          type: boolean
        web_payment_url:
          type: string
        qrcode:
          description: Any type
        is_expired:
          type: boolean
        expires_at:
          type: string
        date:
          type: string
        items:
          type: array
          items:
            description: Any type
        currency:
          $ref: >-
            #/components/schemas/V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataCurrency
        channel:
          $ref: >-
            #/components/schemas/V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaDataChannel
      required:
        - subtotal_amount
        - service_fee
        - total_amount
        - reference_no
        - status
        - is_web_payment
        - web_payment_url
        - is_expired
        - expires_at
        - date
        - items
        - currency
        - channel
      title: >-
        V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaData
    Generate Transaction_Response_200:
      type: object
      properties:
        message:
          type: string
        data:
          $ref: >-
            #/components/schemas/V1BillerTransactionsGeneratePostResponsesContentApplicationJsonSchemaData
      required:
        - message
        - data
      title: Generate Transaction_Response_200
    PostV1BillerTransactionsGenerateRequestUnauthorizedError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PostV1BillerTransactionsGenerateRequestUnauthorizedError
    PostV1BillerTransactionsGenerateRequestUnprocessableEntityError:
      type: object
      properties:
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
      required:
        - message
        - errors
      title: PostV1BillerTransactionsGenerateRequestUnprocessableEntityError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token obtained from the Create Token endpoint. Tokens are valid
        for ~60 minutes — cache and reuse a token for its full lifetime instead
        of re-authenticating per request.

```

## Examples



**Request**

```json
{
  "channel_code": "GCASH_QRPH",
  "amount": 1,
  "reference_no": "ORDER2025X8KQ1",
  "success_redirect_url": "https://epaygames.io/success",
  "failure_redirect_url": "https://epaygames.io/failure",
  "callback_webhook_url": "https://webhook.site/c5170b54-132f-408d-b998-519668c829f9"
}
```

**Response**

```json
{
  "message": "Transaction has been successfully generated.",
  "data": {
    "subtotal_amount": 0.01,
    "service_fee": 0,
    "total_amount": 0.01,
    "reference_no": "TESTQRTVFSXPG2OG",
    "status": "pending",
    "is_web_payment": true,
    "web_payment_url": "https://l-stg.epayg.link/ard6laadxqjqz74",
    "is_expired": false,
    "expires_at": "2025-09-02T10:00:06+08:00",
    "date": "2025-09-01T10:00:06+08:00",
    "items": [],
    "currency": {
      "name": "Philippine Peso",
      "code": "PHP",
      "symbol": "₱"
    },
    "channel": {
      "name": "Maya",
      "instruction": "To complete the transaction, kindly follow these steps:\n 1. Open [Maya Web Payment Link](https://l-stg.epayg.link/ard6laadxqjqz74).\n 2. Complete the **Maya** web payment process.\n 3. Payments are processed once paid.\nNote: You do not need to follow those steps if you already complete the **Maya** web payment process.",
      "slug": "paymaya",
      "code": "PAYMAYA_QR",
      "logo": "https://cdn.eplayment.co/payment-channels/paymaya.jpg",
      "category": {
        "name": "E-Wallet",
        "description": "E-Wallet payment channels.",
        "slug": "e-wallet"
      }
    }
  }
}
```

**SDK Code**

```python Generate Transaction_example
import requests

url = "https://api-stg.epaygames.io/v1/biller/transactions/generate"

payload = {
    "channel_code": "GCASH_QRPH",
    "amount": 1,
    "reference_no": "ORDER2025X8KQ1",
    "success_redirect_url": "https://epaygames.io/success",
    "failure_redirect_url": "https://epaygames.io/failure",
    "callback_webhook_url": "https://webhook.site/c5170b54-132f-408d-b998-519668c829f9"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Generate Transaction_example
const url = 'https://api-stg.epaygames.io/v1/biller/transactions/generate';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"channel_code":"GCASH_QRPH","amount":1,"reference_no":"ORDER2025X8KQ1","success_redirect_url":"https://epaygames.io/success","failure_redirect_url":"https://epaygames.io/failure","callback_webhook_url":"https://webhook.site/c5170b54-132f-408d-b998-519668c829f9"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Generate Transaction_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-stg.epaygames.io/v1/biller/transactions/generate"

	payload := strings.NewReader("{\n  \"channel_code\": \"GCASH_QRPH\",\n  \"amount\": 1,\n  \"reference_no\": \"ORDER2025X8KQ1\",\n  \"success_redirect_url\": \"https://epaygames.io/success\",\n  \"failure_redirect_url\": \"https://epaygames.io/failure\",\n  \"callback_webhook_url\": \"https://webhook.site/c5170b54-132f-408d-b998-519668c829f9\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Generate Transaction_example
require 'uri'
require 'net/http'

url = URI("https://api-stg.epaygames.io/v1/biller/transactions/generate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"channel_code\": \"GCASH_QRPH\",\n  \"amount\": 1,\n  \"reference_no\": \"ORDER2025X8KQ1\",\n  \"success_redirect_url\": \"https://epaygames.io/success\",\n  \"failure_redirect_url\": \"https://epaygames.io/failure\",\n  \"callback_webhook_url\": \"https://webhook.site/c5170b54-132f-408d-b998-519668c829f9\"\n}"

response = http.request(request)
puts response.read_body
```

```java Generate Transaction_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-stg.epaygames.io/v1/biller/transactions/generate")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"channel_code\": \"GCASH_QRPH\",\n  \"amount\": 1,\n  \"reference_no\": \"ORDER2025X8KQ1\",\n  \"success_redirect_url\": \"https://epaygames.io/success\",\n  \"failure_redirect_url\": \"https://epaygames.io/failure\",\n  \"callback_webhook_url\": \"https://webhook.site/c5170b54-132f-408d-b998-519668c829f9\"\n}")
  .asString();
```

```php Generate Transaction_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-stg.epaygames.io/v1/biller/transactions/generate', [
  'body' => '{
  "channel_code": "GCASH_QRPH",
  "amount": 1,
  "reference_no": "ORDER2025X8KQ1",
  "success_redirect_url": "https://epaygames.io/success",
  "failure_redirect_url": "https://epaygames.io/failure",
  "callback_webhook_url": "https://webhook.site/c5170b54-132f-408d-b998-519668c829f9"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Generate Transaction_example
using RestSharp;

var client = new RestClient("https://api-stg.epaygames.io/v1/biller/transactions/generate");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"channel_code\": \"GCASH_QRPH\",\n  \"amount\": 1,\n  \"reference_no\": \"ORDER2025X8KQ1\",\n  \"success_redirect_url\": \"https://epaygames.io/success\",\n  \"failure_redirect_url\": \"https://epaygames.io/failure\",\n  \"callback_webhook_url\": \"https://webhook.site/c5170b54-132f-408d-b998-519668c829f9\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Generate Transaction_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "channel_code": "GCASH_QRPH",
  "amount": 1,
  "reference_no": "ORDER2025X8KQ1",
  "success_redirect_url": "https://epaygames.io/success",
  "failure_redirect_url": "https://epaygames.io/failure",
  "callback_webhook_url": "https://webhook.site/c5170b54-132f-408d-b998-519668c829f9"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-stg.epaygames.io/v1/biller/transactions/generate")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```