Skip to content

Commit

Permalink
chore: update api endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ehrdi committed Aug 19, 2024
1 parent 8b3585a commit 61790f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,37 +48,36 @@ To use this SDK you need to construct a `CommunicatorConfiguration` which encaps
const apiKey = process.env.API_KEY;
const apiSecret = process.env.API_SECRET;

const config = new CommunicatorConfiguration(apiKey, apiSecret, "preprod.commerce-api.payone.com");
const config = new CommunicatorConfiguration(apiKey, apiSecret, 'api.preprod.commerce.payone.com');
```

With the configuration you can create an API client for each reource you want to interact with. For example to create a commerce case you can use the `CommerceCaseApiClient`.


```ts
const commerceCaseClient = new CommerceCaseApiClient(config);
```

All payloads and reponses are availabe as ts interfaces exported from this library.
For example, to create an empty commerce case you can pass an object with the `CreateCommerceCaseRequest` interface:


```ts
const createCommerceCaseRequest: CreateCommerceCaseRequest = {};

const createCommerceCaseResponse: CreateCommerceCaseResponse = commerceCaseClient.createCommerceCaseRequest('merchant_id', createCommerceCaseRequest);
const createCommerceCaseResponse: CreateCommerceCaseResponse = commerceCaseClient.createCommerceCaseRequest(
'merchant_id',
createCommerceCaseRequest,
);
```

The models directly map to the API as described in [PAYONE Commerce Platform API Reference](https://docs.payone.com/pcp/commerce-platform-api).


### Error Handling

When making a request any client may throw a `ApiException`. There two subtypes of this exception:

- `ApiErrorReponseException`: This exception is thrown when the API returns an well-formed error response. The given errors are deserialized into `APIError` objects which are availble via the `getErrors()` method on the exception. They usually contain useful information about what is wrong in your request or the state of the resource.
- `ApiResponseRetrievalException`: This exception is a catch-all exception for any error that cannot be turned into a helpful error response. This includes malformed responses or unknown responses.


### Client Side

For most [payment methods](https://docs.payone.com/pcp/commerce-platform-payment-methods) some information from the client is needed, e.g. payment information given by Apple when a payment via ApplePay suceeds. PAYONE provides client side SDKs which helps you interact the third party payment providers. You can find the SDKs under the [PAYONE GitHub organization](https://github.com/PAYONE-GmbH). Either way ensure to never store or even send credit card information to your server. The PAYONE Commerce Platform never needs access to the credit card information. The client side is responsible for safely retrieving a credit card token. This token must be used with this SDK.
Expand Down Expand Up @@ -132,7 +131,7 @@ npm version major|minor|patch

#### Changelog Generation with Conventional Changelog

The changelog gets generated automatically when the npm version gets bumped via `npm version major|minor|patch` within the `version.sh` script.
The changelog gets generated automatically when the npm version gets bumped via `npm version major|minor|patch` within the `version.sh` script.

1. **Conventional Commit Messages**:

Expand Down
2 changes: 1 addition & 1 deletion example-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const run = async () => {
const communicatorConfiguration = new CommunicatorConfiguration(
apiKey,
apiSecret,
'https://preprod.commerce-api.payone.com',
'https://api.preprod.commerce.payone.com',
);

const commerceCaseApiClientExample = new CommerceCaseApiExample(communicatorConfiguration);
Expand Down

0 comments on commit 61790f1

Please sign in to comment.