gplsek / fitmoostore

fitmostore
GNU General Public License v2.0
0 stars 0 forks source link

braintree customer and card actions #26

Closed jg77merten closed 10 years ago

jg77merten commented 10 years ago

=================CREATE CUSTOMER============= POST http://fitmoostore.loc/fit_store/btcustomer Content-Type: application/json { "customer":"true", <== Required "credit_card" : { <=== "OPTIONAL" "cardholderName" : "Max Klimchuk", "cvv" : "123", "expirationDate" : "05/2020", "number" : "4111111111111111", "options" : { <=== "OPTIONAL" "verifyCard" : "true" <=== "OPTIONAL" } }, "customer_data" : {
"company" : "Maksim Klimchuk", "email" : "sabre+1@tut.by", "firstName" : "Max", "id" : "user_id", <=== "OPTIONAL" if not empty id set as $user->uid ADMIN ONLY "lastName" : "Klimchuk", "phone" : "12345678901", <=== "OPTIONAL" 'fax' : "12345678901", <=== "OPTIONAL" 'website' => "http://" <=== "OPTIONAL"

},

"billing_address" : { <=== "OPTIONAL" "company" : "Maksim Klimchuk", "countryCodeAlpha2" : "US", "extendedAddress" : "", "firstName" : "Max", "lastName" : "Klimchuk", "locality" : "Las Vegas", "postalCode" : "89109", "region" : "NV", "streetAddress" : "3200 S Las Vegas Blvd" } }

-----RESPONSE---- { "success": true, "customer": { "id": "31", "merchantId": "rbmrmqnpcx89pm2p", "firstName": "Max", "lastName": "Klimchuk", "company": "Maksim Klimchuk", "email": "sabre+1@tut.by", "phone": "12345678901", "fax": null, "website": null, "createdAt": { "date": "2014-05-21 12:07:53", "timezone_type": 3, "timezone": "UTC" }, "updatedAt": { "date": "2014-05-21 12:07:53", "timezone_type": 3, "timezone": "UTC" } }, "cc": [ { "_attributes": { "bin": "411111", "expirationMonth": "05", "expirationYear": "2020", "last4": "1111", "billingAddress": { "_attributes": { "id": "8f", "customerId": "31", "firstName": "Max", "lastName": "Klimchuk", "company": "Maksim Klimchuk", "streetAddress": "3200 S Las Vegas Blvd", "extendedAddress": null, "locality": "Las Vegas", "region": "NV", "postalCode": "89109", "countryCodeAlpha2": "US", "countryCodeAlpha3": "USA", "countryCodeNumeric": "840", "countryName": "United States of America", "createdAt": { "date": "2014-05-21 12:07:53", "timezone_type": 3, "timezone": "UTC" }, "updatedAt": { "date": "2014-05-21 12:07:53", "timezone_type": 3, "timezone": "UTC" } } }, "cardType": "Visa", "cardholderName": "Max Klimchuk", "commercial": "Unknown", "countryOfIssuance": "Unknown", "createdAt": { "date": "2014-05-21 12:07:53", "timezone_type": 3, "timezone": "UTC" }, "customerId": "31", "customerLocation": "US", "debit": "Unknown", "default": true, "durbinRegulated": "Unknown", "expired": false, "healthcare": "Unknown", "imageUrl": "https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=sandbox&merchant_id=rbmrmqnpcx89pm2p", "issuingBank": "Unknown", "payroll": "Unknown", "prepaid": "Unknown", "subscriptions": [ ], "token": "8skr2b", "uniqueNumberIdentifier": "3b807d706550a6f93011e4f48b107745", "updatedAt": { "date": "2014-05-21 12:07:53", "timezone_type": 3, "timezone": "UTC" }, "venmoSdk": false, "verifications": [ { "status": "verified", "cvvResponseCode": "M", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "M", "avsStreetAddressResponseCode": "M", "gatewayRejectionReason": null, "merchantAccountId": "sxx2yfjwww9pwpkm", "processorResponseCode": "1000", "processorResponseText": "Approved" } ], "expirationDate": "05/2020", "maskedNumber": "411111**1111" } } ] }

jg77merten commented 10 years ago

-----------CREATE CARD FOR USER--------- POST /fit_store/btcustomer Content-Type: application/json { "card" : "true", <== Required "customer_data" : { <=== "OPTIONAL" if not empty id set as $user->uid ADMIN ONLY "id" : "user_id" }, "credit_card" : { "cardholderName" : "Max Klimchuk", "cvv" : "123", "expirationDate" : "10/2019", "number" : "4111111111111111", "options" : { <==OPTIONAL "verifyCard" : "true" } } } ---RESPONSE--- { "success": true, "creditCard": { "_attributes": { "bin": "411111", "expirationMonth": "10", "expirationYear": "2019", "last4": "1111", "cardType": "Visa", "cardholderName": "Max Klimchuk", "commercial": "Unknown", "countryOfIssuance": "Unknown", "createdAt": { "date": "2014-05-21 13:11:32", "timezone_type": 3, "timezone": "UTC" }, "customerId": "1", "customerLocation": "US", "debit": "Unknown", "default": true, "durbinRegulated": "Unknown", "expired": false, "healthcare": "Unknown", "imageUrl": "https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=sandbox&merchant_id=rbmrmqnpcx89pm2p", "issuingBank": "Unknown", "payroll": "Unknown", "prepaid": "Unknown", "subscriptions": [ ], "token": "d4rz9r", "uniqueNumberIdentifier": "3b807d706550a6f93011e4f48b107745", "updatedAt": { "date": "2014-05-21 13:11:32", "timezone_type": 3, "timezone": "UTC" }, "venmoSdk": false, "verifications": [ { "status": "verified", "cvvResponseCode": "M", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "I", "avsStreetAddressResponseCode": "I", "gatewayRejectionReason": null, "merchantAccountId": "sxx2yfjwww9pwpkm", "processorResponseCode": "1000", "processorResponseText": "Approved" } ], "billingAddress": null, "expirationDate": "10/2019", "maskedNumber": "411111**1111" } } }

jg77merten commented 10 years ago

-----UPDATE CUSTOMER---- PUT /fit_store/btcustomer/1 (integer user_id) Content-Type: application/json { "customer" : "true", <== Required "credit_card" : { <=== OPTIONAL "cardholderName" : "Max Klimchuk1", "cvv" : "123", "expirationDate" : "11/2020", "number" : "4111111111111111", "options" : { <=== OPTIONAL "verifyCard" : "true" } }, "customer_data" : { "company" : "Maksim1 Klimchuk1", "email" : "sabre+1@tut.by", "firstName" : "Max", "lastName" : "Klimchuk", "phone" : "12345678901", <=== OPTIONAL "fax" : "12345678901", <=== OPTIONAL "website'" : "http://", <=== OPTIONAL }, "billing_address" : { <=== OPTIONAL "company" : "Maksim Klimchuk1", "countryCodeAlpha2" : "US", "extendedAddress" : "", "firstName" : "Max", "lastName" : "Klimchuk", "locality" : "Las Vegas", "postalCode" : "89109", "region" : "NV", "streetAddress" : "3200 S Las Vegas Blvd" } } ---RESPONSE--- { "success": true, "customer": { "id": "1", "merchantId": "rbmrmqnpcx89pm2p", "firstName": "Max", "lastName": "Klimchuk", "company": "Maksim1 Klimchuk1", "email": "sabre+1@tut.by", "phone": "12345678901", "fax": null, "website": null, "createdAt": { "date": "2014-05-21 09:56:17", "timezone_type": 3, "timezone": "UTC" }, "updatedAt": { "date": "2014-05-21 13:26:20", "timezone_type": 3, "timezone": "UTC" } }, "cc": [ { "_attributes": { "bin": "411111", "expirationMonth": "11", "expirationYear": "2020", "last4": "1111", "billingAddress": { "_attributes": { "id": "h8", "customerId": "1", "firstName": "Max", "lastName": "Klimchuk", "company": "Maksim Klimchuk1", "streetAddress": "3200 S Las Vegas Blvd", "extendedAddress": null, "locality": "Las Vegas", "region": "NV", "postalCode": "89109", "countryCodeAlpha2": "US", "countryCodeAlpha3": "USA", "countryCodeNumeric": "840", "countryName": "United States of America", "createdAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" }, "updatedAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" } } }, "cardType": "Visa", "cardholderName": "Max Klimchuk1", "commercial": "Unknown", "countryOfIssuance": "Unknown", "createdAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" }, "customerId": "1", "customerLocation": "US", "debit": "Unknown", "default": false, "durbinRegulated": "Unknown", "expired": false, "healthcare": "Unknown", "imageUrl": "https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=sandbox&merchant_id=rbmrmqnpcx89pm2p", "issuingBank": "Unknown", "payroll": "Unknown", "prepaid": "Unknown", "subscriptions": [ ], "token": "j5sjng", "uniqueNumberIdentifier": "3b807d706550a6f93011e4f48b107745", "updatedAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" }, "venmoSdk": false, "verifications": [ { "status": "verified", "cvvResponseCode": "M", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "M", "avsStreetAddressResponseCode": "M", "gatewayRejectionReason": null, "merchantAccountId": "sxx2yfjwww9pwpkm", "processorResponseCode": "1000", "processorResponseText": "Approved" } ], "expirationDate": "11/2020", "maskedNumber": "411111_1111" } }, { "_attributes": { "bin": "411111", "expirationMonth": "10", "expirationYear": "2019", "last4": "1111", "cardType": "Visa", "cardholderName": "Max Klimchuk", "commercial": "Unknown", "countryOfIssuance": "Unknown", "createdAt": { "date": "2014-05-21 13:11:32", "timezone_type": 3, "timezone": "UTC" }, "customerId": "1", "customerLocation": "US", "debit": "Unknown", "default": true, "durbinRegulated": "Unknown", "expired": false, "healthcare": "Unknown", "imageUrl": "https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=sandbox&merchant_id=rbmrmqnpcx89pm2p", "issuingBank": "Unknown", "payroll": "Unknown", "prepaid": "Unknown", "subscriptions": [ ], "token": "d4rz9r", "uniqueNumberIdentifier": "3b807d706550a6f93011e4f48b107745", "updatedAt": { "date": "2014-05-21 13:11:32", "timezone_type": 3, "timezone": "UTC" }, "venmoSdk": false, "verifications": [ { "status": "verified", "cvvResponseCode": "M", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "I", "avsStreetAddressResponseCode": "I", "gatewayRejectionReason": null, "merchantAccountId": "sxx2yfjwww9pwpkm", "processorResponseCode": "1000", "processorResponseText": "Approved" } ], "billingAddress": null, "expirationDate": "10/2019", "maskedNumber": "411111_1111" } } ] }

jg77merten commented 10 years ago

-----update USERs card----------- PUT /fit_store/btcustomer/1 (INTEGER USER_ID) Content-Type: application/json { "card" : "true", <== Required "token" : "j5sjng", <== Required "credit_card" : { "cardholderName" : "Max2 Klimchuk2", "cvv" : "123", "expirationDate" : "10/2019", "number" : "4111111111111111", "options" : { <== optional "verifyCard" : "true" } } } ---response--- { "success": true, "creditCard": { "_attributes": { "bin": "411111", "expirationMonth": "10", "expirationYear": "2019", "last4": "1111", "billingAddress": { "_attributes": { "id": "h8", "customerId": "1", "firstName": "Max", "lastName": "Klimchuk", "company": "Maksim Klimchuk1", "streetAddress": "3200 S Las Vegas Blvd", "extendedAddress": null, "locality": "Las Vegas", "region": "NV", "postalCode": "89109", "countryCodeAlpha2": "US", "countryCodeAlpha3": "USA", "countryCodeNumeric": "840", "countryName": "United States of America", "createdAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" }, "updatedAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" } } }, "cardType": "Visa", "cardholderName": "Max2 Klimchuk2", "commercial": "Unknown", "countryOfIssuance": "Unknown", "createdAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" }, "customerId": "1", "customerLocation": "US", "debit": "Unknown", "default": false, "durbinRegulated": "Unknown", "expired": false, "healthcare": "Unknown", "imageUrl": "https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=sandbox&merchant_id=rbmrmqnpcx89pm2p", "issuingBank": "Unknown", "payroll": "Unknown", "prepaid": "Unknown", "subscriptions": [ ], "token": "j5sjng", "uniqueNumberIdentifier": "3b807d706550a6f93011e4f48b107745", "updatedAt": { "date": "2014-05-21 13:33:46", "timezone_type": 3, "timezone": "UTC" }, "venmoSdk": false, "verifications": [ { "status": "verified", "cvvResponseCode": "M", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "M", "avsStreetAddressResponseCode": "M", "gatewayRejectionReason": null, "merchantAccountId": "sxx2yfjwww9pwpkm", "processorResponseCode": "1000", "processorResponseText": "Approved" }, { "status": "verified", "cvvResponseCode": "M", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "M", "avsStreetAddressResponseCode": "M", "gatewayRejectionReason": null, "merchantAccountId": "sxx2yfjwww9pwpkm", "processorResponseCode": "1000", "processorResponseText": "Approved" } ], "expirationDate": "10/2019", "maskedNumber": "411111**1111" } } }

jg77merten commented 10 years ago

-----GET GUSTOMER INFO--- GET /fit_store/btcustomer?customer=true&id=1 (customer param required, id - user_id) -- response -- { "success": null, "customer": { "id": "1", "merchantId": "rbmrmqnpcx89pm2p", "firstName": "Max", "lastName": "Klimchuk", "company": "Maksim1 Klimchuk1", "email": "sabre+1@tut.by", "phone": "12345678901", "fax": null, "website": null, "createdAt": { "date": "2014-05-21 09:56:17", "timezone_type": 3, "timezone": "UTC" }, "updatedAt": { "date": "2014-05-21 13:26:20", "timezone_type": 3, "timezone": "UTC" } }, "cc": [ { "_attributes": { "bin": "411111", "expirationMonth": "10", "expirationYear": "2019", "last4": "1111", "billingAddress": { "_attributes": { "id": "h8", "customerId": "1", "firstName": "Max", "lastName": "Klimchuk", "company": "Maksim Klimchuk1", "streetAddress": "3200 S Las Vegas Blvd", "extendedAddress": null, "locality": "Las Vegas", "region": "NV", "postalCode": "89109", "countryCodeAlpha2": "US", "countryCodeAlpha3": "USA", "countryCodeNumeric": "840", "countryName": "United States of America", "createdAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" }, "updatedAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" } } }, "cardType": "Visa", "cardholderName": "Max2 Klimchuk2", "commercial": "Unknown", "countryOfIssuance": "Unknown", "createdAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" }, "customerId": "1", "customerLocation": "US", "debit": "Unknown", "default": false, "durbinRegulated": "Unknown", "expired": false, "healthcare": "Unknown", "imageUrl": "https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=sandbox&merchant_id=rbmrmqnpcx89pm2p", "issuingBank": "Unknown", "payroll": "Unknown", "prepaid": "Unknown", "subscriptions": [ ], "token": "j5sjng", "uniqueNumberIdentifier": "3b807d706550a6f93011e4f48b107745", "updatedAt": { "date": "2014-05-21 13:33:46", "timezone_type": 3, "timezone": "UTC" }, "venmoSdk": false, "verifications": [ { "status": "verified", "cvvResponseCode": "M", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "M", "avsStreetAddressResponseCode": "M", "gatewayRejectionReason": null, "merchantAccountId": "sxx2yfjwww9pwpkm", "processorResponseCode": "1000", "processorResponseText": "Approved" }, { "status": "verified", "cvvResponseCode": "M", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "M", "avsStreetAddressResponseCode": "M", "gatewayRejectionReason": null, "merchantAccountId": "sxx2yfjwww9pwpkm", "processorResponseCode": "1000", "processorResponseText": "Approved" } ], "expirationDate": "10/2019", "maskedNumber": "411111_1111" } }, { "_attributes": { "bin": "411111", "expirationMonth": "10", "expirationYear": "2019", "last4": "1111", "cardType": "Visa", "cardholderName": "Max Klimchuk", "commercial": "Unknown", "countryOfIssuance": "Unknown", "createdAt": { "date": "2014-05-21 13:11:32", "timezone_type": 3, "timezone": "UTC" }, "customerId": "1", "customerLocation": "US", "debit": "Unknown", "default": true, "durbinRegulated": "Unknown", "expired": false, "healthcare": "Unknown", "imageUrl": "https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=sandbox&merchant_id=rbmrmqnpcx89pm2p", "issuingBank": "Unknown", "payroll": "Unknown", "prepaid": "Unknown", "subscriptions": [ ], "token": "d4rz9r", "uniqueNumberIdentifier": "3b807d706550a6f93011e4f48b107745", "updatedAt": { "date": "2014-05-21 13:11:32", "timezone_type": 3, "timezone": "UTC" }, "venmoSdk": false, "verifications": [ { "status": "verified", "cvvResponseCode": "M", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "I", "avsStreetAddressResponseCode": "I", "gatewayRejectionReason": null, "merchantAccountId": "sxx2yfjwww9pwpkm", "processorResponseCode": "1000", "processorResponseText": "Approved" } ], "billingAddress": null, "expirationDate": "10/2019", "maskedNumber": "411111_1111" } } ], "addresses": [ { "_attributes": { "id": "h8", "customerId": "1", "firstName": "Max", "lastName": "Klimchuk", "company": "Maksim Klimchuk1", "streetAddress": "3200 S Las Vegas Blvd", "extendedAddress": null, "locality": "Las Vegas", "region": "NV", "postalCode": "89109", "countryCodeAlpha2": "US", "countryCodeAlpha3": "USA", "countryCodeNumeric": "840", "countryName": "United States of America", "createdAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" }, "updatedAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" } } } ] }

jg77merten commented 10 years ago

---GET CARD--- GET /fit_store/btcustomer?card=true&token=j5sjng (card param required, token - credit card token) ----RESPONSE-- { "_attributes": { "bin": "411111", "expirationMonth": "10", "expirationYear": "2019", "last4": "1111", "billingAddress": { "_attributes": { "id": "h8", "customerId": "1", "firstName": "Max", "lastName": "Klimchuk", "company": "Maksim Klimchuk1", "streetAddress": "3200 S Las Vegas Blvd", "extendedAddress": null, "locality": "Las Vegas", "region": "NV", "postalCode": "89109", "countryCodeAlpha2": "US", "countryCodeAlpha3": "USA", "countryCodeNumeric": "840", "countryName": "United States of America", "createdAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" }, "updatedAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" } } }, "cardType": "Visa", "cardholderName": "Max2 Klimchuk2", "commercial": "Unknown", "countryOfIssuance": "Unknown", "createdAt": { "date": "2014-05-21 13:26:19", "timezone_type": 3, "timezone": "UTC" }, "customerId": "1", "customerLocation": "US", "debit": "Unknown", "default": false, "durbinRegulated": "Unknown", "expired": false, "healthcare": "Unknown", "imageUrl": "https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=sandbox&merchant_id=rbmrmqnpcx89pm2p", "issuingBank": "Unknown", "payroll": "Unknown", "prepaid": "Unknown", "subscriptions": [ ], "token": "j5sjng", "uniqueNumberIdentifier": "3b807d706550a6f93011e4f48b107745", "updatedAt": { "date": "2014-05-21 13:33:46", "timezone_type": 3, "timezone": "UTC" }, "venmoSdk": false, "verifications": [ { "status": "verified", "cvvResponseCode": "M", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "M", "avsStreetAddressResponseCode": "M", "gatewayRejectionReason": null, "merchantAccountId": "sxx2yfjwww9pwpkm", "processorResponseCode": "1000", "processorResponseText": "Approved" }, { "status": "verified", "cvvResponseCode": "M", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "M", "avsStreetAddressResponseCode": "M", "gatewayRejectionReason": null, "merchantAccountId": "sxx2yfjwww9pwpkm", "processorResponseCode": "1000", "processorResponseText": "Approved" } ], "expirationDate": "10/2019", "maskedNumber": "411111**1111" } }