{"id":19390297,"url":"https://github.com/jaimerc/payment-gateways-module","last_synced_at":"2026-05-17T19:05:32.853Z","repository":{"id":52205563,"uuid":"238314013","full_name":"JaimeRC/payment-gateways-module","owner":"JaimeRC","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-07T22:44:43.000Z","size":262,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-16T19:06:13.150Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JaimeRC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-02-04T21:48:43.000Z","updated_at":"2021-05-05T08:23:15.000Z","dependencies_parsed_at":"2025-01-07T09:35:01.906Z","dependency_job_id":"0841773c-2e71-449b-90d1-1f389dc51648","html_url":"https://github.com/JaimeRC/payment-gateways-module","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JaimeRC/payment-gateways-module","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaimeRC%2Fpayment-gateways-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaimeRC%2Fpayment-gateways-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaimeRC%2Fpayment-gateways-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaimeRC%2Fpayment-gateways-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JaimeRC","download_url":"https://codeload.github.com/JaimeRC/payment-gateways-module/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaimeRC%2Fpayment-gateways-module/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33151625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-10T10:20:00.586Z","updated_at":"2026-05-17T19:05:32.838Z","avatar_url":"https://github.com/JaimeRC.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Payment Gateway Module\n\n## Paypal\n\n### Flujo\n\n1.- Construir la conexion con PayPal (Server)\n\n        var gateway = braintree.connect({\n            accessToken: useYourAccessToken\n        });\n\n`useYourAccessToken` es el Token de la agencia que se registra en PayPal. \n\n\n2.- Generaramos el ClienToken para que el cliente pueda realizar la transaccion con PayPal. (Server)\n\n        const clientToken = await gateway.clientToken.generate({});\n\n\n3.- Se genera el botón para realizar la Autorización con PayPal, incluyendo el Token y la información del pago para que se muestre la pantalla de Autorización de PayPal y pueda confirmar la operación. (Client)\n\n        paypal.Button.render({\n            braintree: braintree, // Modulo de NPM\n            client: { \n                production: 'CLIENT_TOKEN_FROM_SERVER', // Token para producción\n                sandbox: 'CLIENT_TOKEN_FROM_SERVER' // Token para realizar Test\n            },\n            env: 'production', // Elegir el entorno (production o sandbox)\n            commit: true, // Esto agregara el importe al boton de PayPal\n            payment: function (data, actions) {\n                return actions.braintree.create({\n                    flow: 'checkout', // Tipo de Flow\n                    amount: 10.00, // Importe de la operación\n                    currency: 'USD', // Moneda\n                    enableShippingAddress: true, // Habilitar datos de envio\n                    shippingAddressEditable: false, // habilitar edición de los datos de envio\n                    shippingAddressOverride: { //Datos de envío\n                        recipientName: 'Scruff McGruff',\n                        line1: '1234 Main St.',\n                        line2: 'Unit 1',\n                        city: 'Chicago',\n                        countryCode: 'US',\n                        postalCode: '60652',\n                        state: 'IL',\n                        phone: '123.456.7890'\n                    }\n                });\n            },\n            onAuthorize: function (payload) { \n                // Si se ha autorizado nos devuelve un token `payload.nonce` para enviar al Servidor y finalizar la transacción\n            },\n        }, '#paypal-button');\n\n\n4.- Con el `nonce` recibido se realiza una peticion a PayPal para que se realice el abono a la cuenta de la agencia.\n\n        var saleRequest = {\n            amount: req.body.amount,\n            merchantAccountId: \"USD\",\n            paymentMethodNonce: req.body.nonce,\n            orderId: \"Mapped to PayPal Invoice Number\",\n            descriptor: {\n                name: \"Descriptor displayed in customer CC statements. 22 char max\"\n            },\n            shipping: {\n                firstName: \"Jen\",\n                lastName: \"Smith\",\n                company: \"Braintree\",\n                streetAddress: \"1 E 1st St\",\n                extendedAddress: \"5th Floor\",\n                locality: \"Bartlett\",\n                region: \"IL\",\n                postalCode: \"60103\",\n                countryCodeAlpha2: \"US\"\n            },\n            options: {\n                paypal: {\n                customField: \"PayPal custom field\",\n                description: \"Description for PayPal email receipt\"\n                },\n                submitForSettlement: true\n            }\n        };\n\n        const {success , transaction } = await gateway.transaction.sale\n        \n        if (!success) \n            throw Error('Error in transaction.')\n\n        transaction.status // \"authorized\"\n        transaction.id \n\n            \n### Flujo del Cliente\n![cliente](data/paypal_client.png)\n\n\n### Flujo del Servidor\n![server](data/paypal_server.png)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaimerc%2Fpayment-gateways-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaimerc%2Fpayment-gateways-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaimerc%2Fpayment-gateways-module/lists"}