etpay-dotnet-sdk
1.0.0
dotnet add package etpay-dotnet-sdk --version 1.0.0
NuGet\Install-Package etpay-dotnet-sdk -Version 1.0.0
<PackageReference Include="etpay-dotnet-sdk" Version="1.0.0" />
<PackageVersion Include="etpay-dotnet-sdk" Version="1.0.0" />
<PackageReference Include="etpay-dotnet-sdk" />
paket add etpay-dotnet-sdk --version 1.0.0
#r "nuget: etpay-dotnet-sdk, 1.0.0"
#:package etpay-dotnet-sdk@1.0.0
#addin nuget:?package=etpay-dotnet-sdk&version=1.0.0
#tool nuget:?package=etpay-dotnet-sdk&version=1.0.0
etpay-sdk-net
Source for the EtPay library
Installation
Requires SDK .NET 6.0 (Install the version corresponding to the operating system).
Within the address: [project directory]\Etpay.Services.WebApi
Open the appsettings.json file.
Update the Settings Section parameters with the data received from ETpay.
"Configs": {
"API_URL": "https://<etpay-api-url>",
"MERCHANT_CODE": "<etpay-merchant-code>",
"MERCHANT_API_TOKEN": "9mTf8[...]pThof"
}
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| merchant_code | String | True | Merchant code of the client |
| merchant_api_token | String | True | Merchant api token of the client |
| api_url | String | True | Api url of the client |
Run unit tests
Within the address: [project directory]\Etpay.MSTest
Open Terminal and run:
dotnet test
Verify that the tests run correctly
Correctas! - Con error: X, Superado: X, Omitido: X, Total: X, Duración: XXX ms
Build and run
Within the address: [project directory]\Etpay.Services.WebApi
Open Terminal and run:
dotnet build
dotnet run
Check that the application is running on https://localhost:7076/swagger/index.html
Publish
Define an output directory (example: C:\etpay-sdk-net).
Within the address: [project directory]\Etpay.Services.WebApi
Open Terminal and run:
dotnet publish -c Release -o [Ruta directorio]
Using
Method to create transaction process.
[POST] /api/v1/Transactions/Create
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| merchant_order_id | string | true | Id used by the merchant to identify the transaction. |
| order_amount | string | true | Transaction amount. |
| payment_completed_url | string | true | URL to which the API will redirect in the event of a successful payment. |
| payment_cancellation_url | string | true | URL to which the API will redirect in the event that the payer explicitly cancels the payment, or an unforeseen error occurs. |
| customer_email | string | false | Customer email. |
| user_bank_code | string | false | If this field is sent, the session starts with the bank already selected. |
| user_rut | string | false | If this field is sent, the session starts with the client's RUT already entered in the respective field. |
| is_rut_block | string | false | If this field is sent, the session starts with the client's RUT field already blocked. Important to consider sending user_rut together wit this attribute. |
| concat | string | false | When merchants have URLs that vary based on different inputs, this value is what ETpay uses to recognize the character/symbol that concatenates those inputs. |
| metadata | Metadata | false | Data showing on transaction process |
Parameters Metadata: | Parameter | Type | Required | Description |--------------|---------|-----------|------------------------- | name | string | true | JSON key called "name" | value | string | true | JSON key called "value" | show | boolean | true | JSON key called "show"
Payload:
{
"merchant_order_id": "oc123456",
"order_amount": 1000,
"payment_completed_url": "http://localhost:3000",
"payment_cancellation_url": "http://localhost:3000",
"customer_email": "example@mail.com",
"metadata": [
{
"name": "Cuenta",
"value": "11111",
"show": true
}
]
}
Response
{
"token": "LnA0o[...]UaDgTa",
"signature_token": "J1Bdd[...]jzsLD5",
"terms_url": "https://<etpay-terms-url>"
}
Method to consult payment status (Require at least one argument).
[POST] /api/v1/Transactions/Status
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| session_token | string | false | Received when transaction was created |
| merchant_order_id | string | false | Internal merchant order identifier |
| payment_token | string | false | Received when transaction was created |
Payload:
{
"session_token": "eyJhbGc[...]l_TU2Y",
"merchant_order_id": "oc123456",
"payment_token": "J1Bdd[...]jzsLD5"
}
Response
[
{
"session_token": "wWkob[...]wC0L5",
"merchant_account_bank": "cl_estado",
"merchant_account_type": "cuenta_vista",
"merchant_account": "99999999",
"merchant_name": "Sandbox Developer Merchant",
"merchant_currency": "CLP",
"merchant_order_id": "oc123456789",
"merchant_amount": 1,
"user_bank": "Banco de prueba",
"user_rut": "111111111",
"user_account": "Cuenta Corriente 12345678",
"payment_token": "prNZK[...]yuPfd",
"payment_status": true,
"payment_process": "auto",
"iat": 918273645536271809
}
]
Verify and decode transaction process.
[POST] /api/v1/Transactions/Verify
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| jwt | string | true | Received jwt on transaction succeed |
| signature_token | string | true | Signature Received when transaction was created |
Payload:
{
"jwt": "eyJhbGc[...]l_TU2Y",
"signature_token": "J1Bdd[...]jzsLD5"
}
Response
{
"session_token": "wWkob[...]wC0L5",
"merchant_account_bank": "cl_estado",
"merchant_account_type": "cuenta_vista",
"merchant_account": "99999999",
"merchant_name": "Sandbox Developer Merchant",
"merchant_currency": "CLP",
"merchant_order_id": "oc123456789",
"merchant_amount": 1,
"user_bank": "Banco de prueba",
"user_rut": "111111111",
"user_account": "Cuenta Corriente 12345678",
"payment_token": "prNZK[...]yuPfd",
"payment_status": true,
"payment_process": "auto",
"iat": 918273645536271809
}
Error Handler
- SDK common errors
[POST] /api/v1/Transactions/Verify
| Error | Common Cause |
|---|---|
| TokenVerificationError: Invalid Signature | The signature token value is incorrect for the entered token |
- SDK common errors
[POST] /api/v1/Transactions/Status
| Error | Common Cause |
|---|---|
| ValueError: The function requires at least one argument | No argument was send in this method. Is required at least one |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Etpay.Application.Interface (>= 1.0.0)
- Etpay.Application.Main (>= 1.0.0)
- Etpay.Infrastructure.ServiceAgent (>= 1.0.0)
- Etpay.Transversal.Mapper (>= 1.0.0)
- Swashbuckle.AspNetCore (>= 6.2.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 337 | 5/11/2023 |