1 //1) CreateCharge 2 Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w'); 3 StripeResponseModel response = request.createCharge('4242424242424242', '2013', '10', '123', '2000', 'usd', 'testing'); 4 if(!response.isError){ 5 system.debug('Transaction ID :: ' + response.id); 6 system.debug('Transaction Fee :: ' + response.fee); 7 }else{ 8 system.debug('Error Message :: ' + response.errorResponse.message); 9 } 10 11 //Create charge using customer 12 Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w'); 13 StripeResponseModel response = request.createCharge('cus_EPTWuvf7EXDb4g', '2000', 'usd', 'testing'); 14 if(!response.isError){ 15 system.debug('Transaction ID :: ' + response.id); 16 system.debug('Transaction Fee :: ' + response.fee); 17 }else{ 18 system.debug('Error Message :: ' + response.errorResponse.message); 19 } 20 21 //2) CreateCustomer 22 Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w'); 23 StripeResponseModel response = request.createCustomer('4242424242424242', '10','2013', '123', 'Aslam', '', '', '', '', 'IN', 'aslam.bari@gmail.com', 'test'); 24 if(!response.isError){ 25 system.debug('Customer ID :: ' + response.id); 26 }else{ 27 system.debug('Error Message :: ' + response.errorResponse.message); 28 } 29 30 //3) RetrieveCustomer 31 Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w'); 32 StripeResponseModel response = request.retrieveCustomer('cus_EPTWuvf7EXDb4g'); 33 if(!response.isError){ 34 system.debug('Customer Country :: ' + response.card.country); 35 system.debug('Customer Last4 CC :: ' + response.card.last4); 36 }else{ 37 system.debug('Error Message :: ' + response.errorResponse.message); 38 } 39 40 //4) CreateInvoice 41 Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w'); 42 StripeResponseModel response = request.createInvoice('cus_EPTWuvf7EXDb4g', '2000', 'usd', 'test'); 43 if(!response.isError){ 44 system.debug('Invoice Id :: ' + response.id); 45 }else{ 46 system.debug('Error Message :: ' + response.errorResponse.message); 47 } 48 49 //5) RetrieveInvoice 50 Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w'); 51 StripeResponseModel response = request.retreiveInvoice('ii_W19Xp6cxrqVABH'); 52 if(!response.isError){ 53 system.debug('Invoice Date :: ' + response.created); 54 }else{ 55 system.debug('Error Message :: ' + response.errorResponse.message); 56 } 57 58 //6) CreatePlan 59 Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w'); 60 StripeResponseModel response = request.createPlan('AMX_101', '2000', 'usd', 'month' , 'AMX Testing'); 61 if(!response.isError){ 62 system.debug('Plan Id :: ' + response.id); 63 }else{ 64 system.debug('Error Message :: ' + response.errorResponse.message); 65 } 66 67 //7) RetreivePlan 68 Stripe request = new Stripe('y001LvDyqiGbNZclaaaxxxxttttOJk8w'); 69 StripeResponseModel response = request.retrievePlan('AMX_101'); 70 if(!response.isError){ 71 system.debug('Plan Label :: ' + response.name); 72 }else{ 73 system.debug('Error Message :: ' + response.errorResponse.message); 74 } 75