forked from fixmycode/pykhipu
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
546 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ __pycache__/ | |
*.py[cod] | ||
*$py.class | ||
uv.lock | ||
ejemplo.py | ||
|
||
# C extensions | ||
*.so | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,7 @@ | ||
# Changelog | ||
|
||
Cambios notables de Django Payments Chile | ||
|
||
Formato basado en [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | ||
y este proyecto se adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
- Klap | ||
- Kushki | ||
- Pagofacil | ||
- Transbank WebPayPlus | ||
- Transbank OnePay | ||
|
||
## [2024.9.29] | ||
|
||
- Cambios en Documentacion | ||
- Nuevos providers para: **Flow, Khipu, Payku** | ||
|
||
## [2024.9.23] | ||
## [2024.12.1] | ||
|
||
- Commit Inicial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,17 @@ | ||
# API de django-payments-chile | ||
# Documentación API | ||
|
||
Este documento proporciona una visión general de los diferentes proveedores de pago disponibles en django-payments-chile. Cada proveedor tiene su propia implementación y configuración específica. | ||
## Banks | ||
|
||
Para obtener detalles sobre cada proveedor, consulte los siguientes enlaces: | ||
::: khipu_tools._banks.Banks | ||
|
||
- [FlowProvider](flow-provider.md) | ||
- [KhipuProvider](khipu-provider.md) | ||
- [KlapProvider](klap-provider.md) | ||
- [KushkiProvider](kushki-provider.md) | ||
- [OneclickProvider](oneclick-provider.md) | ||
- [PagofacilProvider](pagofacil-provider.md) | ||
- [PaykuProvider](payku-provider.md) | ||
- [WebpayProvider](webpay-provider.md) | ||
## BankItem | ||
|
||
Cada enlace lo llevará a una documentación detallada sobre la implementación y uso de ese proveedor específico. | ||
::: khipu_tools._banks.BankItem | ||
|
||
## FlowProvider | ||
## Predict | ||
|
||
El FlowProvider es una implementación para integrar la pasarela de pagos Flow en django-payments-chile. | ||
::: khipu_tools._predict.Predict | ||
|
||
### Métodos principales | ||
## Payments | ||
|
||
- `__init__(self, **kwargs)`: Inicializa el proveedor con las configuraciones necesarias. | ||
- `get_form(self, payment, data=None)`: Retorna el formulario para iniciar el proceso de pago. | ||
- `process_data(self, payment, request)`: Procesa los datos recibidos de Flow después de un pago. | ||
|
||
#### Configuración | ||
|
||
Para utilizar FlowProvider, añada la siguiente configuración a `PAYMENT_VARIANTS` en su archivo `settings.py`: | ||
|
||
```python | ||
PAYMENT_VARIANTS = { | ||
"flow": ("django_payments_chile.FlowProvider", { | ||
"api_key": "su_api_key", | ||
"api_secret": "su_api_secret", | ||
"api_endpoint": "sandbox", # Cambie a "live" para producción | ||
"api_medio": 9, # 9 indica todos los medios de pago | ||
}) | ||
} | ||
``` | ||
|
||
#### Uso | ||
|
||
Para crear un pago utilizando FlowProvider: | ||
|
||
```python | ||
from django_payments import get_payment_model | ||
|
||
Payment = get_payment_model() | ||
payment = Payment.objects.create( | ||
variant='flow', # Debe coincidir con la clave en PAYMENT_VARIANTS | ||
amount=1000, | ||
currency='CLP', | ||
description='Descripción del pago' | ||
) | ||
``` | ||
|
||
Consulte la [documentación de Flow](https://www.flow.cl/docs) para más detalles sobre la integración y opciones disponibles. | ||
|
||
## API | ||
|
||
::: django_payments_chile.FlowProvider | ||
::: khipu_tools._payments.Payments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Pagos Automáticos | ||
|
||
Es muy sencillo habilitar el proceso de Pago Automático a tus clientes, sólo necesitas utilizar la API de Suscripción para solicitar un nuevo ID de Suscripción, para asociarlo al servicio que vas a cobrar a tu cliente de forma recurrente. Cuando el cliente finalice el proceso de firma en su banco, recibirá una notificación en la URL de devolución de llamada que proporcionó al solicitar el ID de suscripción. | ||
|
||
Tras una confirmación positiva, puede empezar a utilizar la API de cobro para enviar sus solicitudes de pago automático. La parte restante del proceso es asíncrona y se le notificará cuando finalice el proceso de conciliación. | ||
|
||
## Crear Subscripción | ||
|
||
```py | ||
import khipu_tools | ||
|
||
khipu_tools.api_key = "khipu-apiv3-key | ||
khipu_tools.AutomaticPayments.create( | ||
name="Service XYZ Id 11.222.333-0", | ||
email="[email protected]", | ||
max_amount=1000, | ||
currency="CLP", | ||
notify_url="https://my-domain.biz/subscription-notify-api", | ||
return_url="https://my-domain.biz/subscription-result", | ||
cancel_url="https://my-domain.biz/subscription-cancel" | ||
) | ||
``` | ||
|
||
```json | ||
{ | ||
"subscription_id": "13a0f1aa-5e47-4894-aa8b-282dd19593ec", | ||
"redirect_url": "https://khipu.com/pac-manager/13a0f1aa-5e47-4894-aa8b-282dd19593ec" | ||
} | ||
``` | ||
|
||
## Obtener información de una subscripción | ||
|
||
```py | ||
import khipu_tools | ||
|
||
khipu_tools.api_key = "khipu-apiv3-key | ||
khipu_tools.AutomaticPayments.get(payment_id="13a0f1aa-5e47-4894-aa8b-282dd19593ec") | ||
``` | ||
|
||
Respuesta | ||
|
||
```json | ||
{ | ||
"subscription_id": "13a0f1aa-5e47-4894-aa8b-282dd19593ec", | ||
"status": "SIGNED", | ||
"developer": false, | ||
"customer_bank_code": "8", | ||
"service_reference": "My Merchant name" | ||
} | ||
``` |
Oops, something went wrong.