Pagamenti Ricorrenti estende la API RESTful esistente integrata in Easy Digital Downloads. È possibile accedervi all'indirizzo
https://example.com/edd-api/subscriptions/?key=YOUR_API_KEY&token=YOUR_API_TOKEN
Nota: assicurati di sostituire example.com con il tuo indirizzo e i valori di chiave e token con i tuoi.
L'esempio sopra restituirà un elenco di tutti gli abbonamenti esistenti nello store.
Input
L'API REST di Pagamenti Ricorrenti accetta 3 opzioni oltre a chiave e token: customer, number e paged.
Cliente
L'input per un cliente può essere un intero che rappresenta un customer_id o un indirizzo email. L'URL risultante sarà simile a questo:
https://example.com/edd-api/subscriptions/?key=YOUR_API_KEY&token=YOUR_API_TOKEN&customer=2
o
https://example.com/edd-api/subscriptions/?key=YOUR_API_KEY&token=YOUR_API_TOKEN&[email protected]
Numero
L'opzione number accetta un intero e restituisce quel numero di risultati. Un esempio sarebbe questo:
https://example.com/edd-api/subscriptions/?key=YOUR_API_KEY&token=YOUR_API_TOKEN&number=5
Pagina
L'opzione paged consente di scegliere una porzione di un numero maggiore. Ad esempio, se hai 100 voci e usi number=10, potresti passare paged=2 e ottenere le righe 11-20. Sarebbe così:
https://example.com/edd-api/subscriptions/?key=YOUR_API_KEY&token=YOUR_API_TOKEN&number=10&paged=2
Output
L'output per ogni abbonamento contiene tutte le informazioni su quell'abbonamento, nonché sul cliente e su ogni pagamento di rinnovo (figlio). Inoltre, c'è un valore che indica il tempo impiegato per ottenere le informazioni per tutti i risultati. Esempio:
{
"subscriptions": [
{
"info": {
"u0000EDD_Subscriptionu0000subs_db": {
"table_name": "wp_edd_subscriptions",
"version": "1.0",
"primary_key": "id"
},
"id": "1",
"customer_id": "2",
"period": "month",
"initial_amount": "50.00",
"recurring_amount": "50.00",
"bill_times": "0",
"parent_payment_id": "87",
"product_id": "85",
"created": "2016-03-15 15:36:30",
"expiration": "2016-04-15 23:59:59",
"status": "active",
"profile_id": "paypal-363e3cc178dab152bb59b958024bce75",
"gateway": "paypal",
"customer": {
"id": "2",
"purchase_count": "2",
"purchase_value": "20.000000",
"email": "[email protected]",
"name": "Jane Doe",
"date_created": "2016-03-07 22:33:44",
"payment_ids": "16",
"user_id": "3",
"notes": [
]
}
},
"payments": [
{
"id": 106,
"amount": 10.36,
"date": "March 21, 2016",
"status": "Renewal"
},
{
"id": 105,
"amount": 10,
"date": "March 21, 2016",
"status": "Renewal"
},
{
"id": 104,
"amount": 10,
"date": "March 21, 2016",
"status": "Renewal"
}
]
}
],
"request_speed": 0.076335906982422
}
