{"id":18622189,"url":"https://github.com/highcanfly-club/up2pay","last_synced_at":"2025-11-03T15:30:32.663Z","repository":{"id":249380995,"uuid":"577384669","full_name":"highcanfly-club/up2pay","owner":"highcanfly-club","description":"Simple typescript library implementing the Up2Pay payment solution with 3DSecure v2","archived":false,"fork":false,"pushed_at":"2024-10-18T19:38:09.000Z","size":506,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-27T05:06:52.786Z","etag":null,"topics":["3dsecure","typescript","up2pay"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/highcanfly-club.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-12T16:07:37.000Z","updated_at":"2024-10-18T19:37:19.000Z","dependencies_parsed_at":"2024-07-20T11:44:20.439Z","dependency_job_id":"5eeb40ca-8689-4371-9fba-61fd7d04b4fe","html_url":"https://github.com/highcanfly-club/up2pay","commit_stats":null,"previous_names":["highcanfly-club/up2pay"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/highcanfly-club%2Fup2pay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/highcanfly-club%2Fup2pay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/highcanfly-club%2Fup2pay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/highcanfly-club%2Fup2pay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/highcanfly-club","download_url":"https://codeload.github.com/highcanfly-club/up2pay/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239418544,"owners_count":19635203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3dsecure","typescript","up2pay"],"created_at":"2024-11-07T04:15:58.763Z","updated_at":"2025-11-03T15:30:32.628Z","avatar_url":"https://github.com/highcanfly-club.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# up2pay System\n\n**Up2Pay** is a simple TypeScript library implementing the Up2Pay payment solution with 3DSecure v2.\n\n## Features\n\n- Easy integration with Up2Pay payment gateway\n- Supports 3DSecure v2\n- Sandbox and production environments\n- Detailed transaction validation\n\n## Installation\n\nInstall the library via npm:\n\n```bash\nnpm install @highcanfly-club/up2pay\n```\n\n## Usage\n\n### Basic Setup\n\n```typescript\nimport { Up2Pay } from \"@highcanfly-club/up2pay\";\n\nconst payment = Up2Pay.create({\n    payboxSite: '1999888',\n    payboxRang: '32',\n    payboxIdentifiant: '1686319',\n    payboxHmac: \"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\",\n    payboxEffectue: 'https://www.example.com/payment/success',\n    payboxRefuse: 'https://www.example.com/payment/error',\n    payboxAnnule: 'https://www.example.com/payment/cancelled',\n    payboxAttente: 'https://www.example.com/payment/waiting',\n    payboxRepondreA: 'https://www.example.com/payment/process',\n    amount: 4990, // This is the price x100 to remove the comma\n    email: 'ronan@example.com',\n    firstname: 'Ronan',\n    lastname: 'L.',\n    address1: '18 route de Notre-Dame-de-la-Gorge',\n    zipcode: '74170',\n    city: 'Les Contamines-Montjoie',\n    countrycode: \"250\", // Code ISO-3166-1\n    totalquantity: \"12\",\n    reference: '123456',\n});\n\nconst form = await payment.form();\n```\n\nYou'll get a `form` contains an object similar to the one below.\n\n```json\n{\n  \"url\": \"https://preprod-tpeweb.up2pay.com/cgi/MYchoix_pagepaiement.cgi\",\n  \"method\": \"POST\",\n  \"form\": \"\u003cinput type=\"hidden\" name=\"PBX_SITE\" value=\"1999888\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_RANG\" value=\"32\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_IDENTIFIANT\" value=\"1686319\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_TOTAL\" value=\"0000005000\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_DEVISE\" value=\"978\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_SOURCE\" value=\"RWD\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_CMD\" value=\"123456\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_PORTEUR\" value=\"tester@example.com\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_RETOUR\" value=\"amount:M;paymentId:R;transactionId:T;authorizationId:A;cardType:C;cardNumber:N;cardExpiration:D;error:E;payboxRef:S;date:W;time:Q;signature:K;\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_RUF1\" value=\"POST\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_TIME\" value=\"2023-07-23T15:05:26.181Z\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_HASH\" value=\"SHA512\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_EFFECTUE\" value=\"https://www.exemple.com/payment/success\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_REFUSE\" value=\"https://www.exemple.com/payment/error\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_ANNULE\" value=\"https://www.exemple.com/payment/cancelled\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_ATTENTE\" value=\"https://www.exemple.com/payment/waiting\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_REPONDRE_A\" value=\"https://www.exemple.com/payment/process\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_BILLING\" value=\"\u003c?xml version=\"1.0\" encoding=\"utf-8\" ?\u003e\u003cBilling\u003e\u003cAddress\u003e\u003cFirstName\u003eRonan\u003c/FirstName\u003e\u003cLastName\u003eL.\u003c/LastName\u003e\u003cAddress1\u003e18 route de Notre-Dame-de-la-Gorge\u003c/Address1\u003e\u003cZipCode\u003e74170\u003c/ZipCode\u003e\u003cCity\u003eLes Contamines-Montjoie\u003c/City\u003e\u003cCountryCode\u003e250\u003c/CountryCode\u003e\u003c/Address\u003e\u003c/Billing\u003e\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_SHOPPINGCART\" value=\"\u003c?xml version=\"1.0\" encoding=\"utf-8\" ?\u003e\u003cshoppingcart\u003e\u003ctotal\u003e\u003ctotalQuantity\u003e12\u003c/totalQuantity\u003e\u003c/total\u003e\u003c/shoppingcart\u003e\" /\u003e\u003cinput type=\"hidden\" name=\"PBX_HMAC\" value=\"BAF2413F96EBA244D9E59EF50BD6F8A3A974AE441D3A88A0280EC949E17F4B261A8DDC5438898181AB009369EC3C6E1825377D44D31991CDD47C71339BC8D1AB\" /\u003e\",\n  \"elements\": [\n    {\n      \"name\": \"PBX_SITE\",\n      \"value\": \"1999888\"\n    },\n\n    [...]\n\n    {\n      \"name\": \"PBX_HMAC\",\n      \"value\": \"9AACAEC2F642D1A1A1210E1074A08A290AEB838E58A73C0B9CD41CE02F68EE58CC559989E3701EC168AADB5144915C504C0657D3475CD3808B2F521FFC028344\"\n    }\n  ]\n}\n```\n\nif needed you can provide a optional parameter with baseUrls, default is:\n\n```js\nbaseUrls: {\n  prod: {\n    main: \"https://tpeweb.e-transactions.fr\",\n    fallback: \"https://tpeweb.e-transactions.fr\",\n  },\n  sandbox: {\n    main: \"https://recette-tpeweb.e-transactions.fr\",\n    fallback: \"https://recette-tpeweb.e-transactions.fr\",\n  },\n}\n```\n\nexample:\n\n```js\nimport { Up2Pay } from \"@highcanfly-club/up2pay\"\n\nconst payment = Up2Pay.create({\n    payboxSite: '1999888',\n    payboxRang: '32',\n    payboxIdentifiant: '1686319',\n    payboxHmac: \"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\",\n    payboxEffectue: 'https://www.exemple.com/payment/success',\n    payboxRefuse: 'https://www.exemple.com/payment/error',\n    payboxAnnule: 'https://www.exemple.com/payment/cancelled',\n    payboxAttente: 'https://www.exemple.com/payment/waiting',\n    payboxRepondreA: 'https://www.exemple.com/payment/process',\n    amount: 4990, // This is the price x100 to remove the comma\n    email: 'ronan@example.com',\n    firstname: 'Ronan',\n    lastname: 'L.',\n    address1: '18 route de Notre-Dame-de-la-Gorge',\n    zipcode: '74170',\n    city: 'Les Contamines-Montjoie',\n    countrycode: \"250\", // Code ISO-3166-1\n    totalquantity: \"12\"\n    reference: '123456',\n    baseUrls: {\n              prod: {\n                main: \"https://tpeweb.e-transactions.fr\",\n                fallback: \"https://tpeweb.e-transactions.fr\",\n              },\n              sandbox: {\n                main: \"https://preprod-tpeweb.e-transactions.fr\",\n                fallback: \"https://preprod-tpeweb.e-transactions.fr\",\n              },\n              });\n\nconst form = await payment.form();\n```\n\nNote: It is better to use the `form` string instead of the `elements` array because the values are computed in a given order. This way you are certain that there will be no problem.\n\n### Dynamic Form Population\n\nIf you want to populate dynamically with `form.elements` a form you can use `Up2Pay.populateForm(parentForm,form.elements)`  \nexample:  \n\n```typescript\nimport { Up2Pay } from '@highcanfly-club/up2pay';\n\ntype FormElement = {\n    name: string;\n    value: string;\n};\ntype Up2PayData = {\n    form: string; url: string; method: string; elements: FormElement[];\n}\n\nfetch(`/up2pay/getForm?${searchParams.toString()}`).then(value =\u003e {\n            value.json().then((data: Up2PayData) =\u003e {\n                console.log(data.form);\n                const formElement = (document.getElementById('up2payForm') as HTMLFormElement);\n                Up2Pay.populateForm(formElement,data.elements);\n                up2pay.value = data;\n            })\n        })\n```\n\n### Transaction Validation\n\nAlways use the `payboxRepondreA` URL to validate the transaction server-side: This is a url directly called by Up2Pay from server to server that returns the result of the transaction.\n\n```typescript\nconst { Up2Pay } = require('@highcanfly-club/up2pay');\n\nconst body = {\n  authorizationId: '1234',\n  error: '00000',\n  amount: '4990',\n  signature: 'SQDGFQSDGFQSDFR234GGR23523423',\n  paymentId: '123456'\n};\n\nconst amount = 4990;\nconst status = Up2Pay.isValid(body, amount);\nconsole.log(status); // true if valid\n```\n\n## Contributing\n\nFeel free to open issues or submit pull requests to improve this library.\n\n## License\n\nThis project is licensed under the AGPL-3.0 License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhighcanfly-club%2Fup2pay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhighcanfly-club%2Fup2pay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhighcanfly-club%2Fup2pay/lists"}