Skip to content

E‐Commerce Integration

FabioZumbi12 edited this page Jul 22, 2024 · 7 revisions

Pixelvip integrates to E-Commerces, and no more directly to payment methods and employees.

The user, in your server, will use the command /usarkey like is with generated keys to activate vips, but instead generated key, the key is the order number, where only the user have access, together with order status verification, will determinate if is valid or not. Pixelvip has a system to register used keys and a customizable starting date to allow orders only after that date to be valid as usable keys.
If you want to change the type of order status, you can change the ordercompleted option to your custom status name.

WooCommerce

WooCommerce is a famous WordPress E-Commerce platform allowing us to create beautiful and complex E-Shops for free!

Pixelvip integrates directly into your WooCommerce instance from your own site or from a shared Wordpress installation. It comunicates via Get/Post and its simple to use and setup.

Setup WooCommerce

Follow these instructions in your WooCommerce instance to get the Consumer Key and Consumer Secret:
https://woolentor.com/doc/how-to-find-woocommerce-consumer-key/

If you dont want to read all that tutorial, here's a resume:

In your Wordpress admin panel, go to:
WooCommcerce -> Settings -> tab Advanced -> choose API REST -> button Add Key -> give a description -> set your user (nothing change) -> permission Read image

Don't leave this page until you copy the Consumer Key and Consumer Secret, because this values will be hidden on exit this page. You are done on WooCommerce configurations.

Setup Pixelvip

On Pixelvip side, open the file paymentApis.yml, locate the Consumer Key and Consumer Secret options and paste the vaules. The option shopurl is your E-Commerce adress. Pay attention, where in some cases the E-Shop is in a subfolder in your site, like www.mysite.com/myshop/ and not on root. You should include the Shop subfolder and not only the root site, if not on root.

Here's the config example. Its all commented to help setup!

# =============== PixelVip E-Commerce Options ================
# The configuration is commented! If you need more help or have issues, use our github:
# https://github.com/FabioZumbi12/PixelVip/wiki
# 
# Pixelvip by FabioZumbi12

apis:
  # Set this to true until you is testing the APIs.
  # In test, we will not save the transaction codes.
  # DONT FORGET TO SET THIS TO FALSE WHEN DONE YOUR TESTS!!
  in-test: false
  # The list of your product or variable IDs like is in your E-Commerce (not the order id).
  # Always set the quantity to 1, as the amount bought in your E-Commerce will be multiplied by this command,
  # except for vip days, where you can sell packages of 15 or more days, then you can set 15 on command.
  commandIds:
    1: 'darvip {p} Vip1 15'
    1659: 'silk give {p} iron_golem 1'
    227: 'eco give {p} 10000'
  # How to generate WooCommerce consumer Key and Secret: https://woolentor.com/doc/how-to-find-woocommerce-consumer-key/
  woocommerce:
    use: true
    # Your WooCommerce site url (e.g. http://woocommerce.com).
    # Pay attention for your shop url, if your shop is located on www.mysite.com/myshop/ or on root.
    shopurl: 'https://www.mysite.com'
    # WooCommerce consumer key
    consumerkey: 'ck_124...'
    # WooCommerce consumer secret
    consumersecret: 'cs_dcc...'
    # Ignore orders oldest than this date
    ignoreOldest: '23/12/2023 00:36:27'
    # Status name for completed orders
    ordercompleted: 'completed'

Setup Products

All products in your E-Shop has an ID, without exceptions! You just need to add this ids into paymentApis.yml file, on commandIds section, with the commands related to your product.

Simple Product

In your product list, on hover you can see the ID:
image

Your config shoud be like this:

  commandIds:
    28264: 'silk give {p} allay1'

Variable Product

If you have products with variables, you need to get that variable IDs: image

Your config shoud be like this:

  commandIds:
    567: 'givevip {p} Vip1 15'
    569: 'givevip {p} Vip1 30'
    ...