API Documentation

Quick Start Guide

Follow these steps to get up and running with the JupiPay Payments API in just a few minutes.

1. Get Your API Key

First, you need an API key to authenticate your requests. You can get your key from the Developer section in your JupiPay Dashboard.

  1. Log in to your JupiPay Dashboard.
  2. Navigate to the API Keys section.
  3. Generate a new key or use an existing one.
  4. Keep this key secure and do not expose it on the client-side.

2. Make Your First Request

Let's test your API key by making a simple request to one of the authenticated health check endpoints. This will confirm that your key is valid and you can connect to the API successfully.

Open your terminal and run the following curl command, replacing YOUR_API_KEY with your actual key.

                    
curl --request GET \
  --url https://jupipay.app/api/v1/health/transbank \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Accept: application/json'
                
                

A successful response will look like this, indicating that our connection with Transbank is operational:


{
  "success": true,
  "message": "Transbank service is reachable.",
  "data": {
    "service": "Transbank",
    "status": "OK",
    "details": "Successfully communicated with Webpay Plus."
  }
}
                

3. Create Your First Payment

Now for a real-world example: creating a Webpay Plus payment transaction. This is a two-step process:

  1. Create the transaction: Your server calls our API to get a payment URL.
  2. Redirect the user: You redirect your user to the URL provided by our API to complete the payment.

Here's a simple PHP example using Guzzle to create the transaction:


use GuzzleHttp\Client;

$client = new Client();

$response = $client->post('https://jupipay.app/api/v1/webpay/transactions', [
    'headers' => [
        'Authorization' => 'Bearer YOUR_API_KEY',
        'Content-Type'  => 'application/json',
        'Accept'        => 'application/json',
    ],
    'json' => [
        // 'buy_order' and 'session_id' are optional.
        // If not provided, we will generate them for you.
        'amount'     => 10000,
        'return_url' => 'https://your-store.com/webpay/callback',
    ],
]);

$data = json_decode($response->getBody()->getContents(), true);

// The actual transaction data is nested under `data.transaction`
$transaction = $data['data']['transaction'];

// The 'url' received is the full URL to redirect the user to.
// The 'token' is also provided separately for your reference.
// $transaction['url']
// $transaction['token']

header('Location: ' . $transaction['url']);
exit;
                

Next Steps

Congratulations, you've successfully integrated the basics of JupiPay Payments! Here's where to go next:

  • Explore the Implementation Guides for detailed, step-by-step workflows for different business models.
  • Dive into the full API Reference to see all available endpoints and parameters.
  • Check out the Code Examples for more snippets in different languages.