|
1 | | -# settle-request-generator |
| 1 | +# Settle Request Generator |
| 2 | +This small utility can be used to help with testing the `KEY` authentication method for integration with the Settle API. It generates the correct headers for a signed request using the request parameters and a private key. |
| 3 | + |
| 4 | +## Try it here |
| 5 | + |
| 6 | +https://settleapi.github.io/settle-request-generator |
| 7 | + |
| 8 | +## Authentication with the Settle API |
| 9 | +Please visit the [Settle API documentation](https://developer.settle.eu/authentication.html) for more information on the two types of authentication, `SECRET` and `KEY`. |
| 10 | + |
| 11 | +The api credentials are managed in the [Settle Business portal](https://business.settle.eu/) (a [sandbox version](https://business.sandbox.settle.eu/) is also available) under the *Integration* tab. |
| 12 | + |
| 13 | +To get started you can just let Settle generate the key-pair for you, but please note that the private part is only visible this one time so it might be good to save it somewhere, or you will need to generate a new key-pair if you lose this private part. The public key is saved with your merchant so that Settle can recognise requests on behalf of this merchant. |
| 14 | + |
| 15 | +You can also generate your own key and just upload the public part to Settle. |
| 16 | + |
| 17 | +### Generate RSA private key |
| 18 | +```bash |
| 19 | +openssl genrsa -des -out private.pem 2048 |
| 20 | +``` |
| 21 | + |
| 22 | +You'll have to to enter a passphrase. Under appropriate conditions (noninteractive use with additional encryption) you may/need to remove the passphrase, which you can do using |
| 23 | + |
| 24 | +```bash |
| 25 | +openssl rsa -in private.pem -out private.pem |
| 26 | +``` |
| 27 | + |
| 28 | + |
| 29 | +### Generate RSA public key |
| 30 | + |
| 31 | +```bash |
| 32 | +openssl rsa -in private.pem -outform PEM -pubout -out public.pem |
| 33 | +``` |
| 34 | + |
| 35 | + |
| 36 | +## Field data examples |
| 37 | + |
| 38 | +* **Merchant ID**: `abc123` |
| 39 | +* **API key ID**: `xyz789` |
| 40 | +* **Method**: `POST` |
| 41 | +* **URL**: `https://api.sandbox.settle.eu/merchant/v1/payment_request/` |
| 42 | +* **Request body**: |
| 43 | +```{ |
| 44 | + "payer": "abc123", |
| 45 | + "payee": "msisdn:47123456789", |
| 46 | + "idempotency_id": "04449a4866", |
| 47 | + "currency": "NOK", |
| 48 | + "amount": 1000, |
| 49 | + "require_identified": "True", |
| 50 | + "chat_text": "Some text", |
| 51 | + "expires_in": 120 |
| 52 | +} |
| 53 | +``` |
| 54 | +* **Private keyfor** `xyz789`: |
| 55 | +``` |
| 56 | +-----BEGIN RSA PRIVATE KEY----- |
| 57 | +MIICXQIBAAKBgQCotJXYCo9VPuS1qjBRPAP5jAN9Wj8qmYnKMy31w81jiL3QegVQ/w6pCoy3 |
| 58 | +WdLdVRxBSV4bCcMEAbhHXKgzpX+vB2P6sbmFJkucu1RQMHs9B7JevixVKowdl+U4QooFbtr2 |
| 59 | +JgBFeC4DMIADvBzzEbvKHRRU7hyhDVDjDmrQtC2nlwsfIDAiQABAocGAVCx+EyP5rgPKY2W9 |
| 60 | +cHYjfqQekFFOlpbG2K5sagjPVW5Hu6qzbjyaCKlcvSwBxFKxM0mfD9PjYLFb1tUBqdlyBQFk |
| 61 | +v6jwIi7Xt0hErX6lcCuSFckM3/P3pC2w952v47HA35zdqC1aYW4bKqQ+cGfDqQI8eUFI4kUg |
| 62 | +Quw4cAkCQQD2BP6gxasdSEQhkcfaHmxuJGVH5DGHcZ7krG5zjd8CEAACShPS0cL71gkzVTX0 |
| 63 | +3FYwLW8z6Z+tMGwZRxgDKKyTAkEAr4nlXVzDJJbfP0fJfOnXUyT4XcFu/iw0HRRknaqn79J3 |
| 64 | +uWSCKqDGbS3cgXCYlrcGrIMWQjNDiiE1+1EWk0qw4wsd/bQJBANEbfbH43BnHiDxR+N3uGw+ |
| 65 | +9XrJhvLPT3b6C/wLM3N1d/MTGgC3xFjuPKN5EWdk8zby+RQdMwnkGlj82IUvSBR5gwQcLbg6 |
| 66 | +JkRyc02S0eZCvONK5VBAk6q5TRo6zJqaCnVunOwqoxdTrNOLRNvMiG9OLECQcC5/lBgLfwjS |
| 67 | +jFUCQQCEKcuxG/huGU5PuNRKA5TfpOE9l0cquiI9613YdbbUszc19PWXFywu5ttHzp29y3jE |
| 68 | +5YKEFh8qz9a4GK5ejcIr |
| 69 | +-----END RSA PRIVATE KEY----- |
| 70 | +``` |
| 71 | + |
| 72 | + |
0 commit comments