NAV Navbar
cURL Ruby PHP
  • Topics
  • Introduction
  • Authentication
  • Pagination
  • Errors
  • Webhooks
  • Resources
  • Coupons
  • Orders
  • Products
  • Product Groups
  • Queries
  • Payments
  • Introduction

    Welcome to the Selly API. You can use our API to access Selly API endpoints to build your own systems on top of our platform.

    We have official API wrappers in Ruby and PHP. You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

    The root URL for the API is:

    https://selly.gg/api/v2/
    

    The PHP library can currently only be autoloaded via Composer. 
    

    Authentication

    To authorize, use this code:

    curl "https://selly.gg/api/v2/"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    
    require 'selly'
    
    # This library will automatically handle the Authorization header and encoding it
    Selly.api_key = 'your api key'
    Selly.api_email = 'your account email'
    
    <?php
    
    include __DIR__.'/vendor/autoload.php';
    use \Selly as Selly;
    
    Selly\Client::authenticate('your account email', 'your api key');
    
    ?>
    

    Make sure to use the correct API authentication attributes

    Selly uses API keys via the Authorization header to allow access to the API. You can retrieve and receive a new Selly API key at your settings page.

    The Authorization header is made up of your account's email and API key in the format email:api_key and then encoded via base64.

    Selly expects a valid Authorization header to be included in all requests and that it looks like the following:

    Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk=

    In this example, if we decode the string we'll receive youremail:thisisyourAPIKey which when split would mean that the email provided is youremail and the API key is thisisyourAPIKey.

    A useragent must be set. We recommend you set it to include both your username and domain name. We can utilize this to prevent your service being disrupted from too many requests

    Pagination

    An example of paginating orders:

    curl "https://selly.gg/api/v2/orders?page=10"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    
    Selly::Orders::List(page: 10)
    

    Selly offers the ability to paginate any list or index resource. The X-Total-Pages header returns the total number of pages for the resources at the specific endpoint you're using.

    Query Parameters

    Parameter Default Description
    page 1 Used for pagination

    Errors

    Errors are returned in a JSON structured like this:

    {
      "message": "Order not found",
    }
    

    Validation errors also have an errors attribute

    {
      "message": "Validation failed",
      "errors": [
        "Title can't be blank",
        "Title is too short (minimum is 2 characters)",
        "Title must be present"
      ]
    }
    

    The errors attribute may also be a array if there are multiple errors stacked

    The Selly API uses the following error codes:

    Status Code Meaning
    400 Bad Request - Invalid parameters
    401 Unauthorized - Unable to authenticate
    403 Forbidden - The request is not allowed
    404 Not Found - The specified resource could not be found.
    406 Not Acceptable - You requested a format that isn't json.
    429 Too Many Requests - You have reached the rate limit
    500 Internal Server Error - We had a problem with our server. Try again later. These are rare.
    503 Service Unavailable - We're temporarily offline for maintenance. Please try again later.

    Webhooks

    A example webhook notification on a paid order event

    {
        "id": "fd87d909-fbfc-466c-964a-5478d5bc066a",
        "product_id": "upgrade",
        "email": "alishia@yahoo.com",
        "ip_address": "88.96.129.5",
        "country_code": "US",
        "user_agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36",
        "value": "0.03",
        "currency": "USD",
        "gateway": "Bitcoin",
        "risk_level": 10,
        "status": 100,
        "delivered": "SERIAL-12345-12345",
        "crypto_value": null,
        "crypto_address": null,
        "referral": null,
        "usd_value": "0.03",
        "exchange_rate": "1.0",
        "custom": {},
        "webhook_type": 1,
        "created_at": "2016-11-27T14:20:34.000Z",
        "updated_at": "2016-12-05T21:31:15.000Z"
      }
    

    Webhooks are a HTTP callback event that is sent to the Webhook URL specified for the affected order. All webhook requests are sent as a POST request and are handled independently from the event, asynchronously.

    The content sent in the webhook is a JSON object of the resource that the webhook is related to. If it was a order webhook, which is the only webhook type currently supported, a order object will be sent. A webhook will be sent any time the following attributes change status, crypto_received, crypto_confirmations.

    Webhooks can be simulated via our webhook simulator.

    Signing/Validating

    To verify the authenticity of a webhook request and its payload, we send a X-Selly-Signature header with a HMAC signature comprised of the JSON encoded request body and your webhook secret. Your webhook secret can be changed in the settings page

    Example of how to generate the signature and securely compare it.

    signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha512'), secret, payload.to_json)
    is_valid_signature = ActiveSupport::SecurityUtils.secure_compare(request.headers['X-Selly-Signature'], signature)
    
    <?php
            $signature = hash_hmac('sha512', json_encode($_POST), $secret);
            if hash_equals($signature, $signatureFromHeader) {
                // Webhook is valid 
            }
    ?>
    

    Coupons

    Coupon Object

    {
        "id": "ba6a15",
        "code": "25OFF",
        "discount": 25,
        "max_use": null,
        "product_ids": ["ac24a3"],
        "uses": 0,
        "created_at": "2016-05-15T14:02:47.000Z",
        "updated_at": "2017-08-12T23:37:13.000Z"
    }
    

    Attributes

    Get All Coupons

    curl "https://selly.gg/api/v2/coupons"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    
    Selly::Coupons.list
    
    <?php
    
    $client = new Selly\Coupons;
    $coupons = $client->list();
    
    ?>
    

    The above command returns JSON structured like this:

    [
        {
            "id": "ba6a15",
            "title": "Awesome Product Group",
            "discount": 25,
            "max_use": null,
            "product_ids": ["ac24a3"],
            "uses": 0,
            "created_at": "2016-05-15T14:02:47.000Z",
            "updated_at": "2017-08-12T23:37:13.000Z"
        },
        {
            "id": "12abc3e",
            "title": "Another Product Group",
            "discount": 25,
            "max_use": null,
            "product_ids": ["ac24a3"],
            "uses": 0,
            "created_at": "2016-05-15T14:02:47.000Z",
            "updated_at": "2017-08-12T23:37:13.000Z"
        }
    ]
    

    This endpoint retrieves all coupons.

    HTTP Request

    GET /coupons

    Query Parameters

    Parameter Default Description
    page 1 Used for pagination

    Get a Specific Coupon

    curl "https://selly.gg/api/v2/coupons/ba6a15"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    
    Selly::Coupons.get('ba6a15')
    
    <?php
    
    $client = new Selly\Coupons;
    $coupon = $client->get('ba6a15');
    
    ?>
    

    The above command returns JSON structured like this:

    {
        "id": "ba6a15",
        "code": "25OFF",
        "discount": 25,
        "max_use": null,
        "product_ids": ["ac24a3"],
        "created_at": "2016-05-15T14:02:47.000Z",
        "updated_at": "2017-08-12T23:37:13.000Z"
    }
    

    This endpoint retrieves a specific coupon.

    HTTP Request

    GET /coupons/:ID

    URL Parameters

    Parameter Description
    ID The ID of the coupon to retrieve

    Create a Coupon

    curl -X POST "https://selly.gg/api/v2/coupons"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk=" 
      -d '{"coupon": {"code": "25OFF", "discount": 25, "product_ids": ["ac24a3"]}}'
    
    Selly::Coupons.create(
      code: 'ba6a15',
      discount: '25OFF',
      product_ids: ['ac24a3']
    )
    

    The above command returns JSON structured like this:

    {
        "id": "ba6a15",
        "code": "25OFF",
        "discount": 25,
        "max_use": null,
        "product_ids": ["ac24a3"],
        "created_at": "2017-05-15T14:02:47.000Z",
        "updated_at": "2017-08-12T23:37:13.000Z"
    }
    

    This endpoint creates a coupon.

    HTTP Request

    POST /coupons

    Update a Coupon

    curl -X PUT "https://selly.gg/api/v2/coupons/ba6a15"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk=" 
      -d '{"coupon": {"code": "newcode", "discount": "10"}}'
    
    Selly::Coupons.update('ba6a15',
      code: 'newcode',
      discount: 10
    )
    

    The above command returns JSON structured like this:

    {
        "id": "ba6a15",
        "code": "newcode",
        "discount": 10,
        "max_use": null,
        "product_ids": ["ac24a3"],
        "created_at": "2017-05-15T14:02:47.000Z",
        "updated_at": "2017-08-12T23:37:13.000Z"
    }
    

    This endpoint updates a coupon.

    HTTP Request

    PUT /coupons/:ID

    Orders

    Order Object

    {
        "id": "fd87d909-fbfc-466c-964a-5478d5bc066a",
        "product_id": "upgrade",
        "email": "alishia@yahoo.com",
        "ip_address": "88.96.129.5",
        "country_code": "US",
        "user_agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36",
        "value": "0.03",
        "currency": "USD",
        "gateway": "Bitcoin",
        "risk_level": 10,
        "status": 100,
        "delivered": "SERIAL-12345-12345",
        "crypto_value": 1020304,
        "crypto_address": "1MpSbqnvKu7ckmRbhQ7Mb7vfWBFNvkfS9s",
        "crypto_received": 0,
        "crypto_confirmations": 0,
        "referral": null,
        "usd_value": "0.03",
        "exchange_rate": "1.0",
        "custom": {
          "0": "SomeInput"
        },
        "created_at": "2016-11-27T14:20:34.000Z",
        "updated_at": "2016-12-05T21:31:15.000Z"
      }
    

    Attributes

    Order Statuses

    Code Status
    0 No payment has been received
    51 PayPal dispute/reversal
    52 Order blocked due to risk level exceeding the maximum for the product
    53 Partial payment. When crypto currency orders do not receive the full amount required due to fees, etc.
    54 Crypto currency transaction confirming
    55 Payment pending on PayPal. Most commonly due to e-checks.
    56 Refunded
    100 Payment complete

    Get All Orders

    Selly::Orders.list
    
    <?php
    
    $client = new Selly\Orders;
    $orders = $client->list();
    
    ?>
    
    curl "https://selly.gg/api/v2/orders"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    

    The above command returns JSON structured like this:

    [
        {
        "id": "89ac7499-efc3-4f5b-a2fd-c00fec6aa480",
        "product_id": "ac24a3",
        "email": "john@gmail.com",
        "ip_address": "132.26.9.4",
        "country_code": "US",
        "user_agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2357.124 Safari/537.36",
        "value": "0.03",
        "currency": "USD",
        "gateway": "Bitcoin",
        "risk_level": 9,
        "status": 0,
        "delivered": null,
        "crypto_value": 18301,
        "crypto_address": "1MpSbqnvKu7ckmRbhQ7Mb7vfWBFNvkfS9s",
        "crypto_channel": null,
        "referral": null,
        "usd_value": "0.03",
        "exchange_rate": "1.0",
        "custom": {
          "0": "MyUsername"
        },
        "created_at": "2015-06-11T18:32:01.000Z",
        "updated_at": "2017-02-14T17:47:27.000Z"
      },
      {
        "id": "fd87d909-fbfc-466c-964a-5478d5bc066a",
        "product_id": "upgrade",
        "email": "alishia@yahoo.com",
        "ip_address": "88.96.129.5",
        "country_code": "US",
        "user_agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36",
        "value": "0.03",
        "currency": "USD",
        "gateway": "Ripple",
        "risk_level": 10,
        "status": 100,
        "delivered": "SERIAL-12345-12345",
        "crypto_value": 18301,
        "crypto_address": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
        "crypto_channel": 1921634730,
        "referral": null,
        "usd_value": "0.03",
        "exchange_rate": "1.0",
        "custom": {
          "0": "SomeInput"
        },
        "created_at": "2016-11-27T14:20:34.000Z",
        "updated_at": "2016-12-05T21:31:15.000Z"
      }
    ]
    

    This endpoint retrieves all orders.

    HTTP Request

    GET /orders

    Query Parameters

    Parameter Default Description
    page 1 Used for pagination

    Get a Specific Order

    Selly::Orders.get('fd87d909-fbfc-466c-964a-5478d5bc066a')
    
    <?php
    
    $client = new Selly\Orders;
    $order = $client->get('fd87d909-fbfc-466c-964a-5478d5bc066a');
    
    ?>
    
    curl "https://selly.gg/api/v2/orders/fd87d909-fbfc-466c-964a-5478d5bc066a"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    

    The above command returns JSON structured like this:

    {
        "id": "fd87d909-fbfc-466c-964a-5478d5bc066a",
        "product_id": "upgrade",
        "email": "alishia@yahoo.com",
        "ip_address": "88.96.129.5",
        "country_code": "US",
        "user_agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36",
        "value": "0.03",
        "currency": "USD",
        "gateway": "Bitcoin",
        "risk_level": 10,
        "status": 100,
        "delivered": "SERIAL-12345-12345",
        "crypto_value": 18301,
        "crypto_address": "1MpSbqnvKu7ckmRbhQ7Mb7vfWBFNvkfS9s",
        "crypto_channel": null,
        "referral": null,
        "usd_value": "0.03",
        "exchange_rate": "1.0",
        "custom": {
          "0": "SomeInput"
        },
        "created_at": "2016-11-27T14:20:34.000Z",
        "updated_at": "2016-12-05T21:31:15.000Z"
      }
    

    This endpoint retrieves a specific order.

    HTTP Request

    GET /orders/:ID

    URL Parameters

    Parameter Description
    ID The ID of the order to retrieve

    Products

    Product Object

    {
        "id": "ac24a3",
        "title": "Awesome Product",
        "description": "My description",
        "stock": 2094,
        "price": "0.5",
        "currency": "EUR",
        "product_type": 2,
        "gateways": [
          "bitcoin",
          "paypal",
          "ethereum"
        ],
        "private": false,
        "unlisted": true,
        "seller_note": "Thanks for buying my product",
        "maximum_quantity": null,
        "minimum_quantity": 1,
        "stock_delimiter": ",",
        "webhook_url": null,
        "custom": {},
        "created_at": "2016-05-15T14:02:47.000Z",
        "updated_at": "2017-08-12T23:37:13.000Z"
    }
    

    Attributes

    Get All Products

    Selly::Products.list
    
    <?php
    
    $client = new Selly\Products;
    $products = $client->list();
    
    ?>
    
    curl "https://selly.gg/api/v2/products"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    

    The above command returns JSON structured like this:

    [
        {
            "id": "ac24a3",
            "title": "Awesome Product",
            "description": "My description",
            "stock": 2094,
            "price": "0.5",
            "currency": "EUR",
            "product_type": 2,
            "gateways": [
              "bitcoin",
              "paypal",
              "ethereum",
              "litecoin",
              "stripe",
              "bitcoin_cash",
              "dash",
              "digibyte",
              "perfect_money",
              "zcash"
            ],
            "private": false,
            "unlisted": true,
            "seller_note": "Thanks for buying my product",
            "maximum_quantity": null,
            "minimum_quantity": 1,
            "stock_delimiter": ",",
            "webhook_url": null,
            "custom": {},
            "created_at": "2016-05-15T14:02:47.000Z",
            "updated_at": "2017-08-12T23:37:13.000Z"
        },
        {
            "id": "d8b3cdb7",
            "title": "Dynamic E-book",
            "description": "Testing the description",
            "stock": "∞",
            "price": "1.0",
            "currency": "USD",
            "product_type": 3,
            "gateways": [
              "bitcoin",
              "paypal",
              "litecoin",
              "stripe",
              "zcash"
            ],
            "private": true,
            "unlisted": true,
            "seller_note": "",
            "maximum_quantity": null,
            "minimum_quantity": 1,
            "stock_delimiter": ",",
            "webhook_url": null,
            "custom": {},
            "created_at": "2017-03-25T20:12:20.000Z",
            "updated_at": "2017-03-25T20:14:14.000Z"
        }
    
    ]
    

    This endpoint retrieves all products.

    HTTP Request

    GET /products

    Query Parameters

    Parameter Default Description
    page 1 Used for pagination

    Get a Specific Product

    Selly::Products.get('ac24a3')
    
    <?php
    
    $client = new Selly\Products;
    $product = $client->get('ac24a3');
    
    ?>
    
    curl "https://selly.gg/api/v2/products/ac24a3"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    

    The above command returns JSON structured like this:

    {
        "id": "ac24a3",
        "title": "Awesome Product",
        "description": "My description",
        "stock": 2094,
        "price": "0.5",
        "currency": "EUR",
        "product_type": 2,
        "gateways": [
          "bitcoin",
          "paypal",
          "litecoin",
          "stripe",
          "zcash"
        ],
        "private": false,
        "unlisted": true,
        "seller_note": "Thanks for buying my product",
        "maximum_quantity": null,
        "minimum_quantity": 1,
        "stock_delimiter": ",",
        "webhook_url": null,
        "custom": {},
        "created_at": "2016-05-15T14:02:47.000Z",
        "updated_at": "2017-08-12T23:37:13.000Z"
    }
    

    This endpoint retrieves a specific product.

    HTTP Request

    GET /products/:ID

    URL Parameters

    Parameter Description
    ID The ID of the product to retrieve

    Create a Product

    curl -X POST "https://selly.gg/api/v2/products"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk=" 
      -d '{"product": {"title": "An awesome product", "description": "A test description", "price": "9.99", "currency": "USD", "bitcoin": true, "ethereum": true, "paypal": true, "product_type": 2, "info": "SERIAL1, SERIAL2, SERIAL3"}}'
    
    Selly::Products.create(
      title: 'An awesome product',
      description: 'A test description',
      price: '9.99',
      currency: 'USD',
      gateways: ['bitcoin', 'ethereum', 'paypal'],
      product_type: 2,
      info: 'SERIAL1, SERIAL2, SERIAL3',
    )
    
    <?php
    
    $client = new Selly\Products;
    $products = $client->create([
      'title': 'An awesome product',
      'description': 'A test description',
      'price': '9.99',
      'currency': 'USD',
      'gateways': ['bitcoin', 'ethereum', 'paypal'],
      'product_type': 2,
      'info': 'SERIAL1, SERIAL2, SERIAL3',
    ]);
    
    ?>
    

    The above command returns JSON structured like this:

    {
        "id": "23b15e",
        "title": "Awesome Product",
        "description": "My description",
        "stock": 2,
        "price": "9.99",
        "currency": "USD",
        "product_type": 2,
        "gateways": [
          "bitcoin",
          "paypal",
          "ethereum"
        ],
        "private": false,
        "unlisted": true,
        "seller_note": null,
        "info": "SERIAL1, SERIAL2, SERIAL3",
        "maximum_quantity": null,
        "minimum_quantity": 1,
        "stock_delimiter": ",",
        "webhook_url": null,
        "custom": {},
        "created_at": "2016-05-15T14:02:47.000Z",
        "updated_at": "2017-08-12T23:37:13.000Z"
    }
    

    This endpoint creates a product.

    HTTP Request

    POST /products

    Update a Product

    curl -X PUT "https://selly.gg/api/v2/products/23b15e"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk=" 
      -d '{"product": {"title": "Awesome Product updated", "description": "My description", "price": "10.00", "currency": "SEK"}}'
    
    Selly::Products.update('23b15e',
      title: 'Awesome Product updated',
      description: 'My description',
      price: '10.00'
    )
    

    The above command returns JSON structured like this:

    {
        "id": "23b15e",
        "title": "Awesome Product updated",
        "description": "My description",
        "stock": 2,
        "price": "10.00",
        "currency": "SEK",
        "product_type": 2,
        "gateways": [
          "bitcoin",
          "paypal",
          "ethereum"
        ],
        "private": false,
        "unlisted": true,
        "seller_note": null,
        "info": "SERIAL1, SERIAL2, SERIAL3",
        "maximum_quantity": null,
        "minimum_quantity": 1,
        "stock_delimiter": ",",
        "webhook_url": null,
        "custom": {},
        "created_at": "2016-05-15T14:02:47.000Z",
        "updated_at": "2017-08-12T23:37:13.000Z"
    }
    

    This endpoint updates a product.

    HTTP Request

    PUT /products/:ID

    Delete a Product

    Selly::Products.destroy('ac24a3')
    
    curl -X DELETE "https://selly.gg/api/v2/products/ac24a3"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    

    The above command returns a blank page with a status of 204

    This endpoint deletes a Product

    HTTP Request

    DELETE /products/:ID

    Dynamic Products

    The Dynamic product type is a product type that is fetched externally. Selly will send a Webhook to the dynamic_url and will set the delivered_info of the Order to be the plain text response truncated to 500 characters.

    A common use case of a dynamic product would be license generation or any product that must be generated.

    The response of a dynamic product webhook cannot be a file, HTML, etc. It must be plain text. Invalid use will disable all current and future use of dynamic products for your account

    Product Groups

    Product Group Object

    {
        "id": "ba6a15",
        "title": "Awesome Product Group",
        "product_ids": ["ac24a3"],
        "created_at": "2016-05-15T14:02:47.000Z",
        "updated_at": "2017-08-12T23:37:13.000Z"
    }
    

    Attributes

    Get All Product Groups

    Selly::ProductGroups.list
    
    curl "https://selly.gg/api/v2/product_groups"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    

    The above command returns JSON structured like this:

    [
        {
            "id": "ba6a15",
            "title": "Awesome Product Group",
            "product_ids": ["ac24a3"],
            "created_at": "2016-05-15T14:02:47.000Z",
            "updated_at": "2017-08-12T23:37:13.000Z"
        },
        {
           "id": "12abc3e",
           "title": "Another Product Group",
           "product_ids": ["ac24a3", "32156a"],
           "created_at": "2016-05-15T14:02:47.000Z",
           "updated_at": "2017-08-12T23:37:13.000Z"
        }
    ]
    

    This endpoint retrieves all product groups.

    HTTP Request

    GET /product_groups

    Query Parameters

    Parameter Default Description
    page 1 Used for pagination

    Get a Specific Product Group

    Selly::ProductGroups.get('ba6a15')
    
    curl "https://selly.gg/api/v2/product_groups/ba6a15"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    

    The above command returns JSON structured like this:

    {
        "id": "ba6a15",
        "title": "Awesome Product Group",
        "product_ids": ["ac24a3"],
        "created_at": "2016-05-15T14:02:47.000Z",
        "updated_at": "2017-08-12T23:37:13.000Z"
    }
    

    This endpoint retrieves a specific product group.

    HTTP Request

    GET /product_groups/:ID

    URL Parameters

    Parameter Description
    ID The ID of the product group to retrieve

    Queries

    Query Object

    {
        "id": "7xailomk",
        "secret": "ZevjsxefmknThE1LycJp7HAYZbGv4MNL3bcWU78Wzqxaw4CL7w",
        "title": "Help needed",
        "email": "demo@example.com",
        "message": "Do you have a coupon?",
        "status": 3,
        "country_code": "US",
        "ip_address": "10.0.2.2",
        "avatar_url": "https://camo.selly.gg/6c8b3527c682dcc614b5075218a1bce1b7f044b2/68747470733a2f2f67726176617461722e636f6d2f6176617461722f34303137383332333264396632303561306263333033663464313166633233352e706e673f733d31303026643d68747470733a2f2f73656c6c792e67672f696d616765732f64656661756c742d6176617461722e706e67",
        "created_at": "2017-12-29T00:21:53.000Z",
        "updated_at": "2017-12-29T13:31:08.000Z"
    }
    

    Attributes

    Get All Queries

    curl "https://selly.gg/api/v2/queries"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    

    The above command returns JSON structured like this:

    [
        {
            "id": "yJni9oAy",
            "secret": "6Rkvz8Zpqo5vu23RSTtvrBQzx76q5a6_BVHvQBgsdR1DpE3esg",
            "title": "Product help",
            "email": "demo@example.com",
            "message": "Does this product include a manual?",
            "status": 3,
            "country_code": "US",
            "ip_address": "10.0.2.2",
            "avatar_url": "https://camo.selly.gg/6c8b3527c682dcc614b5075218a1bce1b7f044b2/68747470733a2f2f67726176617461722e636f6d2f6176617461722f34303137383332333264396632303561306263333033663464313166633233352e706e673f733d31303026643d68747470733a2f2f73656c6c792e67672f696d616765732f64656661756c742d6176617461722e706e67",
            "created_at": "2017-12-29T00:21:53.000Z",
            "updated_at": "2017-12-29T13:31:08.000Z"
        },
        {
            "id": "7xailomk",
            "secret": "ZevjsxefmknThE1LycJp7HAYZbGv4MNL3bcWU78Wzqxaw4CL7w",
            "title": "Help needed",
            "email": "demo@example.com",
            "message": "Do you have a coupon?",
            "status": 3,
            "country_code": "US",
            "ip_address": "10.0.2.2",
            "avatar_url": "https://camo.selly.gg/6c8b3527c682dcc614b5075218a1bce1b7f044b2/68747470733a2f2f67726176617461722e636f6d2f6176617461722f34303137383332333264396632303561306263333033663464313166633233352e706e673f733d31303026643d68747470733a2f2f73656c6c792e67672f696d616765732f64656661756c742d6176617461722e706e67",
            "created_at": "2017-12-29T00:21:53.000Z",
            "updated_at": "2017-12-29T13:31:08.000Z"
        }
    ]
    

    This endpoint retrieves all queries.

    HTTP Request

    GET /queries

    Query Parameters

    Parameter Default Description
    page 1 Used for pagination

    Get a Specific Query

    curl "https://selly.gg/api/v2/queries/7xailomk"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    

    The above command returns JSON structured like this:

    {
        "id": "7xailomk",
        "secret": "ZevjsxefmknThE1LycJp7HAYZbGv4MNL3bcWU78Wzqxaw4CL7w",
        "title": "Help needed",
        "email": "demo@example.com",
        "message": "Do you have a coupon?",
        "status": 3,
        "country_code": "US",
        "ip_address": "10.0.2.2",
        "avatar_url": "https://camo.selly.gg/6c8b3527c682dcc614b5075218a1bce1b7f044b2/68747470733a2f2f67726176617461722e636f6d2f6176617461722f34303137383332333264396632303561306263333033663464313166633233352e706e673f733d31303026643d68747470733a2f2f73656c6c792e67672f696d616765732f64656661756c742d6176617461722e706e67",
        "query_message": [  
            {  
             "message": "No coupons are currently available.",
             "is_seller": true,
             "created_at": "2017-12-30T02:28:57.000Z",
             "updated_at": "2017-12-30T02:28:57.000Z"
            }
        ],
        "created_at": "2017-12-29T00:21:53.000Z",
        "updated_at": "2017-12-29T13:31:08.000Z"
    }
    

    This endpoint retrieves a specific query.

    HTTP Request

    GET /queries/:ID

    URL Parameters

    Parameter Description
    ID The ID of the query to retrieve

    Payments

    Selly Payments provides a central implementation to accept a wide range of payment methods including PayPal, Bitcoin, Ripple, Ethereum and Litecoin on your own platform.

    Selly sends a webhook notification once the order status is 100 indicating that the payment is complete. All webhooks are sent to the webhook_url parameter specified when creating the payment.

    For the gateway chosen in the Payment, you must have the correct information (e.g your Bitcoin address if the gateway is Bitcoin) set in your settings.

    Selly Payments does not currently support Perfect Money and Stripe.

    Checkout options

    We currently support two types of checkout flows for Selly Payments, Integrated and White-label.

    Integrated

    With the integrated checkout option, Selly handles the checkout aspect for you by only returning a unique payment URL. This unique URL contains our realtime checkout page, which an example of can be found here.

    White-label

    The white-label checkout flow provides the raw order created rather than a payment URL. With the raw order information, you are able to develop and integrate your own checkout experience completely separate of Selly.

    This has the added downside of not having the realtime status updates that the integrated checkout flow offers, but this can of course be implemented on your side using the webhook sent anytime the status, crypto_received, crypto_confirmations attributes change.

    Create a Payment

    We highly suggest that you pass in the customer's IP address in ip_address. This defaults to the IP address that calls the endpoint.

    curl -X POST "https://selly.gg/api/v2/pay"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
      -d '{"title":"Selly Pay Example", "gateway":"Bitcoin", "email":"customer@email.com", "value":"10", "currency":"USD", "return_url":"https://website.com/return", "webhook_url":"https://website.com/webhook?secret=cEZMeEVlTz"}'
    
    Selly::Pay.create(
      title: 'Selly Pay Example',
      gateway: 'Bitcoin',
      email: 'customer@email.com',
      value: 10.00,
      currency: 'USD',
      return_url: 'https://website.com/return',
      webhook_url: 'https://website.com/webhook?secret=cEZMeEVlTz'
    )
    
    <?php
    
    $client = new Selly\Payments;
    $payment = $client->create([
      'title' => 'Selly Pay Example',
      'gateway' => 'Bitcoin',
      'email' => 'customer@email.com',
      'value'=> 10.00,
      'currency' => 'USD',
      'return_url' => 'https://website.com/return',
      'webhook_url' => 'https://website.com/webhook?secret=cEZMeEVlTz'
    ]);
    ?>
    

    The above command returns JSON structured like this:

    {
        "url": "https://selly.gg/pay/81971eae19ff0924026d7b2a7502b20372c15df5/bGU3Q09QSGtDNjR2cHJMYzhHdTd6Mm40bXpFNVdZOEtlaW9NckRySmxsVkZOSjhkb3N0SVM0cVF6UDJtU0NjejVrT0Q4ZFZKY1JVbi9ZTjJaSDhGRXc9PS0tdW5zUGptYjcrSGZSRjF5K0VmNUFNZz09--68ab83743fa057629b09bb9c7330841e54442784"
    }
    

    The customer should be redirected to this URL to activate the checkout experience. Click here for a preview

    White label example

    curl -X POST "https://selly.gg/api/v2/pay"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
      -d '{"title":"Selly Pay Example", "gateway":"Bitcoin", "email":"customer@email.com", "value":"10", "currency":"USD", "return_url":"https://website.com/return", "webhook_url":"https://website.com/webhook?secret=cEZMeEVlTz", "white_label":"true"}'
    
    Selly::Pay.create(
      title: 'Selly Pay Example',
      gateway: 'Bitcoin',
      email: 'customer@email.com',
      value: 10.00,
      currency: 'USD',
      return_url: 'https://website.com/return',
      webhook_url: 'https://website.com/webhook?secret=cEZMeEVlTz',
      white_label: true
    )
    
    <?php
    
    $client = new Selly\Payments;
    $products = $client->create([
      'title': 'Selly Pay Example',
      'gateway': 'Bitcoin',
      'email': 'customer@email.com',
      'value': 10.00,
      'currency': 'USD',
      'return_url': 'https://website.com/return',
      'webhook_url': 'https://website.com/webhook?secret=cEZMeEVlTz',
      'white_label': true
    ]);
    
    ?>
    

    The above command returns JSON structured like this:

    {
        "status": 0,
        "crypto_address": null,
        "crypto_value": null,
        "confirmations_needed": 6,
        "id": "16d37578-ced4-4a18-90c7-596a8e472e69",
        "product_id": "pay",
        "email": "test@test.com",
        "value": "10.0",
        "quantity": 1,
        "currency": "USD",
        "gateway": "PayPal",
        "crypto_channel": null,
        "usd_value": "10.0",
        "exchange_rate": "1.0",
        "created_at": "2018-04-21T13:21:19.000+01:00",
        "updated_at": "2018-04-21T13:21:19.000+01:00",
        "url": "https://www.paypal.com/webscr?cmd=_ap-payment&paykey=AP-5U570312BD011483Y"
    }
    

    Attributes

    Delete a Payment

    The ID is the first path on the URL returned when creating a payment. The ID for the above example is as follows:

    Selly::Pay.destroy('81971eae19ff0924026d7b2a7502b20372c15df5')
    
    curl -X DELETE "https://selly.gg/api/v2/pay/81971eae19ff0924026d7b2a7502b20372c15df5"
      -H "Authorization: Basic eW91cmVtYWlsOnRoaXNpc3lvdXJBUElLZXk="
    

    The above command returns JSON structured like this:

    {
        "status": true
    }
    

    This endpoint deletes a Selly Pay payment

    HTTP Request

    DELETE /pay/:ID