When you create a site that supports loyalty points, you must create an exchange rate. You can create multiple exchange rates, but the site will determine which configuration to use when converting currency.

To create an exchange rate between currency and loyalty points, issue a POST request to the /ccadmin/v1/exchangerates endpoint on the administration server. Specify the values of the currency properties as a JSON map in the body of the request.

The following table describes properties in the body of the request.

Property

Description

id

A string that specifies the ID for the Exchange Rate.

sourceCurrency

A string that specifies the custom currency code that you use to indicates loyalty points. The sourceCurrency is the currency associated with the order.

targetCurrency

A string that specifies the monetary currency code to which the loyalty points should be converted. TargetCurrency should be the same as the site’s secondaryCurrency. The targetCurrency equals the sourceCurrency multiplied by the exchangeRate.

exchangeRate

A number that indicates the exchange rate. This rate is multiplied by the sourceCurrency to obtain the target currency.

The following example shows a sample request for creating an exchange rate between a monetary currency and the loyalty program’s currency that you created in the Implement loyalty points section:

POST /ccadmin/v1/exchangerates HTTP/1.1
Content-Type: application/json
Authorization: Bearer <access_token>

{
  "sourceCurrency": "USD",
  "targetCurrency": "PTS",
  "exchangeRate": 5
}

If the exchange rate is created successfully, the response body returned includes the ID for the new currency and a link to the URL used in the request. The following is a sample response.

{
  "sourceCurrency": "USD",
  "targetCurrency": "PTS",
  "exchangeRate": 5,
  "id": "10001"

}

Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices