Creating Test Payment Methods for Customers
Creating Test Payment Methods for Customers
The Cortex API contains resources that allow REGISTERED and PUBLIC customers to use test credit cards and test token payment methods. This section describes how to enable these resources and how to add these paymentmethods to REGISTERED customers through Cortex Studio.
These resources are only for testing purchase workflows in a developer environment. Do not use these resources in production.
Creating a Test Credit Card Payment Method
To Enable Cortex API Test Credit Card Resource:
- Start your Cortex API server.
- Navigate to http://<Your cortex server>/system/console/configMgr. If Cortex API is running on a local server at port 8080, the URL is http://localhost:8080/cortex/system/console/configMgr
- Enter the User Name and Password in the Authentication dialog box: The default credentials are:
- Select Configuration from the OSGi drop-down list.
- Click the TestCreditCardResource, select the Create Cards checkbox, and then click save.
To create a test credit card for a PUBLIC or REGISTERED customer:
- In Cortex Studio, generate a PUBLIC or REGISTERED customer access token (see Cortex Studio: Getting Started)
- GET the following URI: /paymentmethods/mobee/creditcards/tests/form
- Fill out the credit card details and then click the createpaymentmethodaction button to create the credit card.
- If the post is successful, status 201 returns and Cortex Studio forwards you to the new paymentmethod. Unsuccessful creation returns a status 400. As this feature is for test purposes only, credit-card validation is not performed.
Creating a Test Token Payment Method
To Enable the Test Token Payment Method in Cortex API:
- Start your Cortex API server.
- Navigate to http://<Your cortex server>/system/console/configMgr. If Cortex API is running on a local server at port 8080, the URL is http://localhost:8080/cortex/system/console/configMgr
- Enter the User Name and Password in the Authentication dialog box: The default credentials are:
- Select Configuration from the OSGi drop-down list.
- Click the TestPaymentTokenResource, select the Create Tokens checkbox, and then click save.
To create a test Token for a PUBLIC or REGISTERED customer:
- In Cortex Studio, generate a PUBLIC or REGISTERED customer access token (see Cortex Studio: Getting Started)
- POST the following form to /cortex/testdefaultpaymenttoken
{ value:"test token guid", display:"test token display value", username:"oliver.harris@elasticpath.com", scope:"mobee" }
The sample form creates a token for oliver.harris@elasticpath.com called test token display value.
- If the post is successful, a status 200 returns and the database tpaymenttoken table updates with the customer's token.