Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Noman's avatar
Level 1

omnipay

i use this pakage for payment https://github.com/thephpleague/omnipay plz any one tell me how to use this pakage both for stripe and paypal_pro..........any one have complete controller plzzz send me.........and how to store card detail in our database for later charge from it...

0 likes
5 replies
nikocraft's avatar

You should not store credit card details in your database, credit card details should never even hit your server if you want to be able to charge people. To store creditcard details on your server you must have PCI complience.

What is PCI compliance? The Payment Card Industry Data Security Standard (PCI DSS) applies to companies of any size that accept credit card payments. If your company intends to accept card payment, and store, process and transmit cardholder data, you need to host your data securely with a PCI compliant hosting provider.

That's why you should use Cachier and either Stripe or Braintree. I am using Braintree since they accept paypal payments as well. Braintree is actually Paypal owned company. Use them and ditch omnipay.

You will not find many tutorials that explain how to integrate Braintree into your project. I am doing that currently and I actually payed a professional to produce a demo for me demonstrating one time payment and subscriptions.

Studying that demo I am able to integrate Braintree into my own project.

I'll probably write a tutorial on how to use Braintree soon.

1 like
Noman's avatar
Level 1

dear some one demand only use omnipay..........if u know how can charge from credit card later but authorize card detail in early........

nikocraft's avatar

who demands omnipay? omnipay is just php package, nobody should demand from you to use this package unless your boss told you you must use this package, in that case look for another boss :)

Noman's avatar
Level 1

lol yea dear my boss is demand................i think about ur sugestion and search for a new boss

1 like
Noman's avatar
Level 1

namespace App\Http\Controllers;

use Illuminate\Http\Request; use Omnipay\Omnipay; use App\Http\Requests; use Omnipay\Common\CreditCard;

class paypalController extends Controller { public function index(){

                                                         $gateway = Omnipay::create('AuthorizeNet_CIM');
                                                         $gateway->setapiLoginId('9E8sR7a5L');
                                                         $gateway->settransactionKey('7R6Zc8F7tt543Tse');

                                                           $gateway->setTestMode(true);
                                                            $gateway->setdeveloperMode(true);
        //t key 7534HY2E9fpn9Kv3                                                

        //s key Simon
                //dd($gateway);           
                    
                    
                                                                            
                                                        $formInputData = array(
                                                                        
                                                                        'firstName' => 'noman',
                                                                        'lastName' => 'shah',
                                                                        'number' => '4012888888881881',
                                                                        'expiryMonth' =>'03',
                                                                        'expiryYear'=>'2017',
                                                                        'cvv'=>'123',
                                                                        'billingAddress1' =>'dublin',
                                                                        'billingPostcode' =>'12345',
                                                                        'billingState' =>'california',
                                                                        'billingCountry' =>'US',
                                                                        'billingPhone' =>'03038869074',
                                                                        'billingCity'=>'dublin',
                                                                        'email' =>'nomanshah587@yahoo.com'
                                                                              );
                                                            //dd($formInputData);
                                                            $card = new CreditCard($formInputData);
                                                    
                                
                                            //dd($card);
                                                        $number = $card->getNumber();
                                                        $card->setFirstName('noman');

                                    //dd($number);  
                                    
    
                                                
                                                $card = new CreditCard($formInputData);
                                                
                                                //dd($card);
                                                $request = $gateway->authorize(array(
                                                                 
                                                                'amount' => '10.00',
                                                                'card' => $card,
                                                                'returnUrl' => 'http://localhost/strip/public/success',
                                                                ));
                        
                    //echo "<pre>"; print_r($request);  exit;                           
                
                    $response = $gateway->purchase(array('amount' => '10.00','card' => $card,'cardReference'=>'visa','returnUrl' => 'http://localhost/strip/public/success','cancelUrl' =>  'http://localhost/strip/public/',))->send();
                    
                        //echo "<pre>"; print_r($response); exit;                           

                    if ($response->isSuccessful()) {
                    return" payment is complete";
                }
           else{
                    return" not successful";
                }
                    
                    

}                                   

}

error

[code] => E00003 [text] => The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:customerProfileId' element is invalid - The value '' is invalid according to its datatype 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:numericString' - The Pattern constraint failed. )

how can i create customerProfileId in this code plzzz help anyone

Please or to participate in this conversation.