Catalog Access Tutorial

Introduction

This documentation aims to guide developers in the integration of the sales catalog and ordering, with or without payment, using the Yoplanning.pro API. The objective is to enable the sale of Yoplanning activities within your system. We assume that you have already read the API documentation and that you own your API token.

Integration Workflow Steps

1. Recovery of your Team’s Data

  • Endpoint: /api/v3.1/teams/

  • Essential Information: team_id and vendor_id

  • Usage: The team_id is required for almost all API requests. The vendor_id is necessary if you want to use the Payment Manager.

2. Obtaining the Product List

  • Endpoint: /api/v3.1/teams/[teamId]/online-products/

  • Function: Retrieves the list of products that can be sold online.

  • Additional parameters:

    • lang: (string) Indicates the language of translatable fields (like title, description, etc.). Use an ISO2 code. Default: en (English). Possible options: fr (French), de (German).

    • start_date: (date) Filters results to only return those with availability after this date. Date format: YYYY-MM-DD.

    • end_date: (date) Filters results to only return those with availability before this date. Date format: YYYY-MM-DD.

    • category: (string) Filters products by specific category.

3. Recovery of Product Availability

  • Endpoint: /api/v3.1/teams/[teamId]/online-products/[productId]/availabilities/

  • Function: Shows available sessions for a specific product.

  • Filtering: Date, price, number of tickets, staff (instructor), etc.

4. (Optional) Recovery of Available Options (Equipment)

  • Endpoint: /api/v3.1/teams/[teamId]/availability-details/[pk]/

  • Function: Retrieves details of options available for a specific session.

5. (Optional) Checking Availability

  • Endpoint: /api/v3.1/teams/[teamId]/order-validation

  • Function: Allows you to check if the contents of the basket are still available before finalizing the order.

6. (Optional) Creating a Payment via the Payment Manager

  • Endpoint: https://payment.yoplanning.pro/api/create-payment

  • Function: Creates a payment and retrieves the payment link.

  • IPN Management: Management of Instant Payment Notification on the callback URL provided.

7. Placing the Order

  • Endpoint: /api/v3.1/teams/[teamId]/orders/

  • Function: Registers the order in Yoplanning, updates the schedule, displays the order and participants in Yoplanning, notifies staff and updates availability.

Example of Usage with cURL

  • Recovery of Products:

curl https://yoplanning.pro/api/v3.1/teams/5a90332e-568f-4980-9859-88a984844a4d/online-products -H 'Authorization: Token 4504c2cb0d87a93106d4de029f407c86149f2ada'

* **Retrieval of Product Availability**: ```bash curl https://yoplanning.pro/api/v3.1/teams/5a90332e-568f-4980-9859-88a984844a4d/online-products/f16ed6c6-e972-4232-b452-ecd393e61642/availabilities -H 'Authorization: Token 4504c2cb0d87a93106d4de029f407c86149f2ada' ``` * **Placing the Order**: ```bash curl -H "Content-Type: application/json" -X POST -d '{"external_reference" : "956", "items" : [{"session_group" : "4f655815-58d9-4c7c-b1c9-2ea152073371", "price" : {"amount" : 51.25}, "client" : {"id" : "71ea849f-226c-4302-a433-528179634aa7", "first_name" : "John", "last_name" : "Doe", "email" : "john.doe@gmail.com"}}], "payments" : [{"amount" : 51.25, "client" : {"first_name" : "Framold", "last_name" : "Doe", "email" : "john.doe@gmail.com"}}]}' https://yoplanning.pro/api/v3.1/teams/5a90332e-568f-4980-9859-88a984844a4d/orders -H 'Authorization: Token 4504c2cb0d87a93106d4de029f407c86149f2ada' ```

Make sure to replace the IDs and tokens with those of your Team for all requests.


Note: This documentation is a basic example of integration. For more specific details and advanced use cases, please see the official Yoplanning.pro API documentation.

Last updated