Integrating your e-commerce with Wirecard

1. Creating a Wirecard test account

Hi, welcome to Wirecard! On this page, you will find practical information on how to integrate your applications with the Wirecard APIs. But first, so you can start using them, you must create an account in our test environment. It is a very easy process, and in this testing environment, you will be able to take a look at all the integration steps.

The test account is a totally separate account from the production Wirecard Account, so much so that you access these two accounts through different addresses and they can have different logins as well if you wish. Ah, and most importantly: the creation of one does not imply the creation of the other. When you finish the implementation using the test account, you must create a production Wirecard account.

But now we just need you to have a Sandbox account yourself! You can create it by clicking here.

2. Getting your Access Keys

Once you've created your test account, you'll need to pick up the credentials (token and key) to be able to make calls to our APIs. This information is within your account Wirecard test account and you can access them in Minha conta > Configurações > Chaves de Acesso.

To authenticate your requests using our API's, you must generate a Base64 hash composed by your credentials (token:key).

Authorization: Basic BASE64(API_TOKEN:API_KEY)

The result will be similar to:

Authorization: Basic MDEwMTAxMDEwMTAxMDEwMTAgMDEwMTAxMDEgMTAxMDE6QUJBQgFCQUJBQkFCQUJBQkFCQUJBQgFCQUJBQkFCQUJBQkFCQUJBQg==

If you need it, you can use the credentials above to perform your tests. In all requests examples, there are valid test keys for the consumption of our API.

📘

LOGIN AND PASSWORD

Your test account login is the email used in the registry.
The password is also set at the time of registration. You do not have to wait for Wirecard's confirmation email to be sent to you to start using our APIs in the test environment.

3. Products

Choose the type of integration you will have with Wirecard based on your business model!

So you're going to make sales without splitting or transferring the amounts, right? Cool, the Wirecard for E-commerce is a complete toolkit for creating your e-commerce and easily receiving payments. From the creation of a simple payment by credit card to the implementation of structures to perform 1click2buy, refunds, and pre-authorizations.

Here you will find the APIs to perform split the value with some suppliers, or to have a platform with merchants and split the values at the time of the transaction. Use Connect to connect to other accounts as simply as "Login with Facebook" and start performing operations on their behalf. Create Wirecard accounts within your own system, split payments, refunds, and other transactions.

Now if you have a solution that needs recurring payments, the Wirecard Subscriptions API is your option. Create plans and subscriptions that we are responsible for generating the invoices as often as you need!

4. Aren't you a developer?

I think this page must be looking a bit confusing. If you're not a developer, maybe an e-commerce module or platform is the best choice for you, look:

Modules: are simple application software to your site that provides the services required for a virtual store. See some of the modules that already offer Wirecard as a means of payment: Magento, OpenCart, OsCommerce, PrestaShop e WooCommerce.

Platforms: are sites that host your virtual store and provide the structure (servers, tools, and layout) and services needed to process your payments. Wirecard is already integrated into several national and international e-commerce platforms. If you want to take a look at the list of available platforms, you can access our documentation by clicking here. The list is on the left menu, at the end of it! :)

Charging your first transaction

I guess you're anxious to get started, right? Ok! :)
In this example, we demonstrate the simplest integration with Wirecard which is the creation of a credit card transaction.

The integration begins with the creation of an Order. The Order must contain the information pertinent to what is being sold, be it a product, service, or a simple billing. It is important that we have this information so that you have more security because, with them, we will do a transaction anti-fraud analysis.

Below is an example (in cURL) of creating an Order using only the mandatory attributes.

{
  "ownId": "order_unique_code",
  "items": [
    {
      "product": "Product name",
      "quantity": 1,
      "detail": "Product details",
      "price": 7300
    }
  ],
  "customer": {
    "ownId": "customer_unique_code",
    "fullname": "Customer Full Name",
    "email": "[email protected]"
  }
}
curl -v https://sandbox.moip.com.br/v2/orders \
   -H 'Content-Type: application/json'  \
   -H 'Authorization: Basic MDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDE6QUJBQkFCQUJBQkFCQUJBQkFCQUJBQkFCQUJBQkFCQUJBQkFCQUJBQg==' \
   -d '{
  "ownId": "order_unique_code",
  "items": [
    {
      "product": "Product name",
      "quantity": 1,
      "detail": "Product details",
      "price": 7300
    }
  ],
  "customer": {
    "ownId": "customer_unique_code",
    "fullname": "Customer Full Name",
    "email": "[email protected]"
  }
}'

Once this is done, you will receive an object of the type Order with the details shown below.

{
  "id": "ORD-KWH58PQA3RTG",
  "ownId": "order_unique_code",
  "status": "CREATED",
  "createdAt": "2015-04-29T12:07:58-0300",
  "amount": {
    "total": 2300,
    "fees": 0,
    "refunds": 0,
    "liquid": 0,
    "otherReceivers": 0,
    "currency": "BRL",
    "subtotals": {
      "shipping": 0,
      "addition": 0,
      "discount": 0,
      "items": 2300
    }
  },
  "items": [
    {
      "product": "Product name",
      "quantity": 1,
      "detail": "Product details",
      "price": 7300
    }
  ],
  "customer": {
    "id": "CUS-BDKZ3SP6OUGX",
    "ownId": "customer_unique_code",
    "fullname": "Customer Full Name",
    "createdAt": "2015-04-29T12:07:58-0300",
    "email": "[email protected]",
    "taxDocument": {
      "type": "UNKNOWN",
      "number": ""
    },
    "_links": {
      "self": {
        "href": "https://sandbox.moip.com.br/v2/customers/CUS-BDKZ3SP6OUGX"
      }
    }
  },
  "payments": [],
  "refunds": [],
  "entries": [],
  "events": [
    {
      "createdAt": "2015-04-29T12:07:58-0300",
      "description": "",
      "type": "ORDER.CREATED"
    }
  ],
  "receivers": [
    {
      "moipAccount": {
        "login": "[email protected]",
        "fullname": "Wirecard Devs Account",
        "id": "MPA-CULBBYHD11"
      },
      "amount": {
        "fees": 0,
        "refunds": 0,
        "total": 2300
      },
      "type": "PRIMARY"
    }
  ],
  "_links": {
    "self": {
      "href": "https://sandbox.moip.com.br/v2/orders/ORD-KWH58PQA3RTG"
    },
    "checkout": {
      "payCreditCard": {
        "redirectHref": "https://checkout-sandbox.moip.com.br/creditcard/ORD-KWH58PQA3RTG"
      },
      "payBoleto": {
        "redirectHref": "https://checkout-sandbox.moip.com.br/boleto/ORD-KWH58PQA3RTG"
      }
    }
  }
}

The next step is to receive this order. For this, you must create a Payment associated with this order. In this example, we will make the payment by means of a credit card. If you prefer, you can direct your customer to Wirecard Checkout by using the corresponding payment form (eg: _links.checkout.payCreditCard) returned in the order callback.

{
      "installmentCount":2,
      "fundingInstrument":{
        "method":"CREDIT_CARD",
        "creditCard":{
          "expirationMonth":12,
          "expirationYear": 25,
          "number": "5555666677778884",
          "cvc": "123",
          "holder":{
            "fullname":"Holder Name",
            "birthdate":"1988-12-30",
            "taxDocument":{
              "type":"CPF",
              "number":"12345679891"
            },
            "phone":{
              "countryCode":"55",
              "areaCode":"11",
              "number":"66778899"
            }
          }
        }
      }
    }
curl -v https://sandbox.moip.com.br/v2/orders/{id}/payments \
     -H 'Content-Type: application/json'  \
     -H 'Authorization: Basic MDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDE6QUJBQkFCQUJBQkFCQUJBQkFCQUJBQkFCQUJBQkFCQUJBQkFCQUJBQg==' \
     -d '{
      "installmentCount":2,
      "fundingInstrument":{
        "method":"CREDIT_CARD",
        "creditCard":{
          "expirationMonth":12,
          "expirationYear": 25,
          "number": "5555666677778884",
          "cvc": "123",
          "holder":{
            "fullname":"Holder Name",
            "birthdate":"1988-12-30",
            "taxDocument":{
              "type":"CPF",
              "number":"12345679891"
            },
            "phone":{
              "countryCode":"55",
              "areaCode":"11",
              "number":"66778899"
            }
          }
        }
      }
    }'

❗️

ATTENTION

The sensitive data on the card must always pass through encryption

After the payment is created, you'll receive the callback with the result of the transaction.

{
  "id": "PAY-3QHGJL1ORP6L",
  "status": "IN_ANALYSIS",
  "amount": {
    "fees": 187,
    "refunds": 0,
    "liquid": 1813,
    "currency": "BRL",
    "total": 2000
  },
  "installmentCount": 1,
  "fundingInstrument": {
    "creditCard": {
      "id": "CRC-TZW7KI7M46YF",
      "brand": "MASTERCARD",
      "first6": "555566",
      "last4": "8884",
      "holder": {
        "birthdate": "30/12/1988",
        "taxDocument": {
          "type": "CPF",
          "number": "33333333333"
        },
        "fullname": "Holder Name"
      }
    },
    "method": "CREDIT_CARD"
  },
  "fees": [
    {
      "type": "TRANSACTION",
      "amount": 187
    }
  ],
  "events": [
    {
      "createdAt": "2015-04-01T15:45:04-0300",
      "type": "PAYMENT.IN_ANALYSIS"
    },
    {
      "createdAt": "2015-04-01T15:45:01-0300",
      "type": "PAYMENT.CREATED"
    }
  ],
  "_links": {
    "order": {
      "title": "ORD-F3BE7QOLKON3",
      "href": "https://sandbox.moip.com.br/v2/orders/ORD-F3BE7QOLKON3"
    },
    "self": {
      "href": "https://sandbox.moip.com.br/v2/payments/PAY-3QHGJL1ORP6L"
    }
  },
  "createdAt": "2015-04-01T15:45:01-0300",
  "updatedAt": "2015-04-01T15:45:04-0300"
}

You can track status changes for both Order and Payment through Webhooks.

Homologation

As soon as you complete the test integration, you will be eligible for our approval flow.
This is the final step before you going to production. Our team will do some purchase testing and, if the integration meets our requirements, you will receive the credentials for use of the production API.