# Becca's Home API ## Customers ### Payment Methods GET - `/api/v1/payment_methods` #### Response { "payment_methods": [ { "id": "a3dd23a8-538f-42ff-9881-c230fb43df26", "customer_id": "63dfb655-5f8c-40cb-be22-9df1930ac145", "payment_method_type": "card", "stripe_id": "pm_1JJXyOCCrM7VZROXKA2lH4Hp", "is_default": false, "created_at": "2021-08-01T06:16:34.062Z", "updated_at": "2021-08-27T12:17:03.955Z", "details": {...} }] } POST - `/api/v1/payment_methods` #### Params { card: { customer_name, number, exp_month, exp_year, cvc, is_default } } #### Response Success(200) { message, payment_method } Error (422) { error } // validation errors ### Payments POST - `/api/v1/payments` #### Params { payment: { amount, lease_id, payment_method_id, payment_type, payment_date } } // amount is in cents #### Response Success(200) { message } Error (422) { error } ### Leases GET - `/api/v1/leases` #### Response { "leases_count": 1, "leases": [ { "id": "bcc9bf40-eeb1-49d6-9f38-6f2d98136d80", "slug": "LID00031", "start_date": "2021-08-01", "payment_schedule": "10 Sep 2021", "upcoming_invoice": null, "is_eligible_for_ninty_day_pay_off": true, "customer_id": "63dfb655-5f8c-40cb-be22-9df1930ac145", "lease_status": "active", "payment_amount": "1000.0", "last_payment": null, "overdue_amount": "0.0", "outstanding_amount": "10000.0", "goodwill_received": "0.0", "end_date": "2021-10-15", "created_at": "2021-08-01T06:16:34.111Z", "updated_at": "2021-08-01T06:16:34.111Z" } ] } GET - `/api/v1/leases/:id` #### Response { "lease": {...}, "payments": [...] } ## LMS ### Customers GET - `/api/v1/customers` ### Leases GET - `/api/v1/customers/:id/leases` #### Response { "leases": [ { "id": "e4b7db53-ca82-42c8-a045-294282f6bf71", "customer_id": "a154ef89-5f1d-42c0-97b5-0fee847ac1e9", "lease_status": "initiated", "slug": "LID00007", "payment_amount": "1000.0", "start_date": "2021-07-30", "last_payment": null, "overdue_amount": "0.0", "outstanding_amount": "10000.0", "goodwill_received": "0.0", "end_date": null, "created_at": "2021-07-30T14:13:45.017Z", "updated_at": "2021-07-30T14:13:45.017Z" } ] } GET - `/api/v1/customers/:id/leases/:lease_id` #### Response { "lease": { "id": "e4b7db53-ca82-42c8-a045-294282f6bf71", "customer_id": "a154ef89-5f1d-42c0-97b5-0fee847ac1e9", "lease_status": "initiated", "slug": "LID00007", "payment_amount": "1000.0", "start_date": "2021-07-30", "last_payment": null, "overdue_amount": "0.0", "outstanding_amount": "10000.0", "goodwill_received": "0.0", "end_date": null, "created_at": "2021-07-30T14:13:45.017Z", "updated_at": "2021-07-30T14:13:45.017Z" } } ### Payments GET - `/api/v1/customers/:id/payments` #### Response { "payments_count": 1, "payments": [ { "id": "3e41348a-9474-44b1-95e3-eab3c5f72cbe", "lease_id": "bcc9bf40-eeb1-49d6-9f38-6f2d98136d80", "customer_id": "63dfb655-5f8c-40cb-be22-9df1930ac145", "category": "invoice", "amount": "1000.0", "payment_date": "2021-08-18", "created_at": "2021-08-18T07:42:02.392Z", "updated_at": "2021-08-18T07:42:02.392Z", "stripe_id": "pi_3JPjPQCCrM7VZROX0hMszQEp", "payment_method_id": "a3dd23a8-538f-42ff-9881-c230fb43df26", "status": "processing", "lease": {...}, "payment_method": {...} } ] } POST - `/api/v1/customers/:id/payments` #### Params { payment: { amount, lease_id, payment_method_id, payment_type, payment_date } } // amount is in cents #### Response Success(200) { message } Error (422) { error } ### Payment Methods GET - `/api/v1/customers/:id/payment_methods` #### Response { "payment_methods_count": 2, "payment_methods": [ { "id": "471b18ed-b274-44b5-a2e5-2126c9a3339a", "customer_id": "a154ef89-5f1d-42c0-97b5-0fee847ac1e9", "payment_method_type": "card", "stripe_id": "pm_1JIwUKCCrM7VZROXkCyEBIFF", "is_default": true, "created_at": "2021-07-30T14:15:03.286Z", "updated_at": "2021-07-30T14:15:03.286Z", "details": {...}, "number": null, "last_used": null, "name": null } ] } POST - `/api/v1/customers/:id/payment_methods` #### Params { card: { customer_name, number, exp_month, exp_year, cvc, is_default } } #### Response Success(200) { message, payment_method } Error(422) { error } // validation errors