NAV Navbar
Logo

- Quick guide -

Display an Oney pop-in

Use Oney payment simulation data to display a pop-in.

This feature is only available if you subscribed to the Premium offer.


Which programming language do you prefer?

| PHP | Python |

Use arrow keys or space bar to navigate in the presentation.

Installing the Library

1- Download the library on GitHub:

github.com/payplug/payplug-php

github.com/payplug/payplug-python

2- Add to all your pages that use the API:

<?php
require_once('PATH_TO_PAYPLUG/payplug_php/lib/init.php');
import payplug

Authentication

Verify your identity when communicating with the API by providing a secret key in all your requests.

To submit your credentials, include your key in all pages that use the API:

<?php
\Payplug\Payplug::init(array(
  'secretKey' => 'sk_live_YOUR_PRIVATE_KEY',
  'apiVersion' => 'THE_API_VERSION',
));
payplug.set_secret_key('sk_live_YOUR_PRIVATE_KEY')

API keys start with “sk_”.
They are available in My account, then API Credentials in the PayPlug portal.

Access LIVE and TEST modes using the same endpoint. To switch between modes, simply provide the related secret key to the mode you wish to access.

Take a look at the changelog to know which api version you should use.

The Oney pop-in

Oney pop-in

The data used to display the pop-in can be acquired using the Oney payment simulation endpoint.

The Oney payment simulation request

The following code shows an example of an Oney payment simulation request.

<?php
$simulations = \Payplug\OneySimulation::getSimulations(array(
  'amount' => 17266,
  'country' => 'FR',
  'operations' => ['x3_with_fees', 'x4_with_fees']
));
data = {
  'amount': 17266,
  'country': 'FR',
  'operations': ['x3_with_fees', 'x4_with_fees']
}
simulations = payplug.OneyPaymentSimulation.get_simulation(**data)

The Oney payment simulation data

The data can be used to display the pop-in.

{
  "result": true,
  "simulations": {
    "x3_with_fees": {...},
    "x4_with_fees": {
      "installments": [
        {
          "date": "2021-01-22T01:00:00.000Z",
          "amount": 4316
        },
        {
          "date": "2021-02-22T01:00:00.000Z",
          "amount": 4316
        },
        {
          "date": "2021-03-22T01:00:00.000Z",
          "amount": 4317
        }
      ],
      "total_cost": 380,
      "nominal_annual_percentage_rate": 18.05,
      "effective_annual_percentage_rate": 19.62,
      "down_payment_amount": 4697
    }
  }
}

Mapping the fields

Pop-in Data
Pour un montant de amount sent as request data
Premier apport down_payment_amount
Coût du financement total_cost
TAEG effective_annual_percentage_rate
Mensualité n°1 installments[0]['amount']
Mensualité n°2 installments[1]['amount']
Mensualité n°3 installments[2]['amount']
Total down_payment_amount + installments[0]['amount'] + installments[1]['amount'] + installments[2]['amount']

Links & Resources


[ Click to return to the beginning of presentation ]