Envoi

SimplyPaie REST API

SimplyPaie has a powerful REST API, which allows you to get access to all SimplyPaie features from your own app.

For all your integration process, feel free to create your account on our Sandbox site.

1. Connecting to the API

2. Creating a payment request

3. Getting a filtered list of payments

4. Reminding a payment request

5. Cancelling a payment request

6. Cash a preauthorized payment

7. Refund a cashed payment

8. Create an invoice

Connecting to the API

# Send your GET request to this url:
GET https://www.simplypaie.fr/api/connection HTTP/1.1

# With your credentials as headers:
  'apiClientId: 123456',
  'apiSecret: f159a84ee9d816a51619c261654d1989523b51ab645cd94865a39f84bf9c98e6',

# You will get a JSON back, in case of success:
HTTP 200 OK
{
  status: 'success',
  apiToken: '1c552e139b9c8a552e316e54b5c98a5d',
  expires: '2017-05-01 15:30:23'
}

# In case of failure:
HTTP 401 Unauthorized
{
  status: 'failure',
  errors: [
     'Incorrect credentials'
  ]
}

?

This request sends you back a temporary token apiToken which allows you to use the API.

Once connected, you can perform all the operations below.
Creating a payment request

# Send your POST request to this url:
POST https://www.simplypaie.fr/api/payments/new HTTP/1.1

# With your apiClientId and apiToken as headers:
  'apiClientId: 123456',
  'apiToken: 1c552e139b9c8a552e316e54b5c98a5d',

# Choose your parameters for the request to be created
{
  email: 'test@simplypaie.fr',
  name: 'Dupont Jean',
  mode: 'email',
  type: 'standard',
  page: 'standard', # Use 'short' simplified payment page
  amount: '10000', # In cents
  currency: 'EUR',
  returnURL: 'https://www.simplypaie.fr', # URL to return to after payment is done
}

# You will get back the following JSON:
# In case of success:
HTTP 201 Created
{
  status: 'success',
  info: {
    paymentId: '165985',
    link: 'https://www.simplypaie.fr/pay-48512-1aa19814b3354e218f4f11f'
  }
}
# In case of failure:
HTTP 400 Bad Request
{
  status: 'failure',
  errors: [
    'Invalid or unavailable currency',
    'Invalid amount'
  ]
}

?
Request parameters reference:

Choose the payment mode
"email" : automatically sends the payment request email
"link" : creates the request without sending an email

Choose the payment type
"standard" : classic payment
"preauth" : preauthorization on the card (cashable within 6 days and 12 hours)

Choose the amount
In cents.

Choose the currency
"EUR" or "USD" or "GBP".
Getting a filtered list of payments

# Send your GET request to this URL, with the following parameters (all optional):
GET https://www.simplypaie.fr/api/payments/list HTTP/1.1
  ?paymentId=684951&
  name=Dupont&
  email=jean.dupont@simplypaie.fr&
  mode=email&
  type=standard&
  page=standard&
  minAmount=0&
  maxAmount=10000&
  currency=EUR&
  status=cashed&
  way=debit&
  minDate=2017-01-01&
  maxDate=2017-01-30

# With your apiClientId and apiToken as headers:
  'apiClientId: 123456',
  'apiToken: 1c552e139b9c8a552e316e54b5c98a5d',

# You will get back the following JSON:
# In case of success:
HTTP 200 OK
{
  status: 'success',
  payments: [
     {
      paymentId: '85916',
      date: '2017-05-19 07:20:19',
      type: 'standard',
      fees: '58',
      mode: 'link',
      page: 'standard',
      amount: '500',
      currency: 'EUR',
      way: 'debit',
      name: 'Jean Dupont',
      email: 'jean.dupont@simplypaie.fr',
      link: 'https://www.simplypaie.fr/pay-5173-fb67df7939a9fa',
      returnURL: 'https://www.simplypaie.fr',
    }
  ]
}
# In case of failure:
HTTP 400 Bad Request
{
  status: 'failure',
  errors: [
    'Invalid or unavailable currency',
    'Incorrect amount'
  ]
}

?
Request parameters reference:

Choose the payment status
"waiting" : payments waiting to be cashed
"reminded" : reminded payments
"cashed" : cashed payments
"preauthorized" : preauthorized payments (but not cashed yet)

Choose the payment mode
"web" : payment created with a SimplyPaie payment button on a website
"email" : payment created with a payment request e-mail
"sms" : payment created with a payment request sms
"link" : payment created without a request
"simply" : simplypaie special payment

Choose the payment type
"standard" : classic payment
"preauth" : preauthorization on the card (cashable within 6 days and 12 hours)

Choose the page type
"standard" : classic payment page
"short" : short payment page, useful for minimalist designs

Choose the payment's way
"debit" : you are paid
"credit" : you pay
Reminding a payment request

# Send your POST request to this url, where paymentId is the id of the payment request to be reminded
POST https://www.simplypaie.fr/api/payments/paymentId/remind HTTP/1.1

# With your apiClientId and apiToken as headers:
  'apiClientId: 123456',
  'apiToken: 1c552e139b9c8a552e316e54b5c98a5d',

# You will get back the following JSON:
# In case of success:
HTTP 200 OK
{
  status: 'success'
}
# In case of failure:
HTTP 404 Not Found
{
  status: 'failure',
  errors: [
    'Unremindable payment'
  ]
}

?
Request parameters reference:

Choose your payment by its paymentId
Cancelling a payment request

# Send your POST request to this url, where paymentId is the id of the payment request to be canceled
POST https://www.simplypaie.fr/api/payments/paymentId/cancel HTTP/1.1

# With your apiClientId and apiToken as headers:
  'apiClientId: 123456',
  'apiToken: 1c552e139b9c8a552e316e54b5c98a5d',

# You will get back the following JSON:
# In case of success:
HTTP 200 OK
{
  status: 'success'
}
# In case of failure:
HTTP 404 Not Found
{
  status: 'failure',
  errors: [
    'Payment missing'
  ]
}

?
Request parameters reference:

Choose your payment by its paymentId

Si la demande de paiement a été créée en mode email, un e-mail d'annulation sera envoyé
Cash a preauthorized payment

# Send your POST request to this url, where paymentId is the id of the payment request to be cashed
POST https://www.simplypaie.fr/api/payments/paymentId/cash HTTP/1.1

# With your apiClientId and apiToken as headers:
  'apiClientId: 123456',
  'apiToken: 1c552e139b9c8a552e316e54b5c98a5d',

# Choose the amount to be cashed
{
  amount: '10000', # In cents
}

# You will get back the following JSON:
# In case of success:
HTTP 200 OK
{
  status: 'success'
}
# In case of failure:
HTTP 404 Not Found
{
  status: 'failure',
  errors: [
    'Amount too high'
  ]
}

?
Request parameters reference:

Choose your preauthorized payment by its paymentId

Choose the amount
In cents. It has to be lower than the previously created preauthorization.
Refund a cashed payment

# Send your POST request to this url, where paymentId is the id of the payment to be refunded
POST https://www.simplypaie.fr/api/payments/paymentId/refund HTTP/1.1

# With your apiClientId and apiToken as headers:
  'apiClientId: 123456',
  'apiToken: 1c552e139b9c8a552e316e54b5c98a5d',

# You will get back the following JSON:
# In case of success:
HTTP 200 OK
{
  status: 'success'
}
# In case of failure:
HTTP 404 Not Found
{
  status: 'failure',
  errors: [
    'Payment unrefundable or missing'
  ]
}

?
Request parameters reference:

Choose your payment by its paymentId
Create an invoice

# Send your POST request to this url, where paymentId is the id of the payment to be refunded
POST https://www.simplypaie.fr/api/invoices/new HTTP/1.1

# With your apiClientId and apiToken as headers:
  'apiClientId: 123456',
  'apiToken: 1c552e139b9c8a552e316e54b5c98a5d',

# Choose the parameters of the invoice to create
{
  name: 'Société SARL',
  address: '1, rue de l\'exemple',
  type: 'normal',
  date: '2017-12-01', # Format YYYY-MM-DD
  currency: 'EUR', # ISO 4217 ('EUR', 'USD', 'GBP')
  deposit: '20.50', # Amount of the advance payment
  items: [
    {
      designation: 'Produit 1',
      price: '26.30',
      quantity: '3',
      vat: '20', # VAT rate in percent
    },
  ],
}

# You will get back the following JSON:
# In case of success:
HTTP 200 OK
{
  status: 'success',
  info: {
    idfact: '16548',
    url: 'https://www.simplypaie.fr/factures/1aa19814b3354e218f4f11f/FactureVente.pdf',
  }
}
# In case of failure:
HTTP 400 Bad Request
{
  status: 'failure',
  errors: [
    'Invalid designation'
  ]
}

?
Request parameters reference:

Choose the type of invoice
"normal" : create a regular invoice
"quote" : create a quote
"order" : creates a receipt for the order