Petit problème avec l'API Stripe Cartalyst.

Discussion dans 'Développement d'un site Web ou d'une appli mobile' créé par ortolojf, 2 Décembre 2017.

  1. ortolojf
    ortolojf WRInaute accro
    Inscrit:
    14 Août 2002
    Messages:
    2 817
    J'aime reçus:
    8
    Bonjour

    J'ai l'API Cartalyst Stripe.

    Je butte sur un problème de l'API Stripe Cartalyst dans le code ci-dessous :

    J'ai mis dans cette array, les signatures des méthodes des classes des objets.

    Les fonctions correspondent aux objets, et leurs arguments sont séparés par des underscores.

    _selfId_ est toujours l'Id de l'objet.

    Dans l'objet : ApplicationFeeRefund, quels sont les ApplicationsFeeId ( de l'objet ApplicationFee ), et quels sont les selfId ( de l'objet ApplicationFeeRefund ) ?

    Merci beaucoup.



    PHP:
    <span class="syntaxhtml"><br /><br /><span class="syntaxdefault"><?php<br />    </span><span class="syntaxcomment">/*<br />     * Voir la documentation<br />     * de la Stripe API.<br />     */<br /><br /></span><span class="syntaxdefault">    </span><span class="syntaxcomment">/**<br />    /**<br />     * <br />     * Cette fonction produit les fonctions<br />     * possibles des objets Stripe.<br />     */<br /></span><span class="syntaxdefault">    function nice_stripe_functions</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$object</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault">        $traduct </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Balance"</span><span class="syntaxdefault">         </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"current"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxcomment">//                "BalanceTransaction"    => array(),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Charge"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"capture_selfId_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Customer"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"delete_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"deleteDiscount_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Dispute"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"update_chargeId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"close_chargeId"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxcomment">//                "DisputeEvidence"    => array( ),<br />//                "Payout"        => array( ),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Refund"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_chargeId_amount_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_chargeId_refundId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_chargeId_refundId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_chargeId_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Token"</span><span class="syntaxdefault">            </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxcomment">//                "BankAccount"        => array( ),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Card"</span><span class="syntaxdefault">            </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_customerId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_customerId_cardId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_customerId_cardId,_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"delete_customerId_carId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_customerId_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxcomment">//                "Source"        => array( ),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Coupon"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"delete_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxcomment">//                "Discount"        => array( ),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Invoice"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_customerId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"invoiceLineItems_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"upcomingInvoice_customerId_subscriptionId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"pay_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxcomment">//                "LineItem"        => array( ),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"InvoiceItem"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_customerId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"delete_selfid"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Plan"</span><span class="syntaxdefault">            </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"delete_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Subscription"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_customerId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_customerId_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_customerId_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"delete_customerId_cardId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_customerId_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxcomment">//                "SubscriptionItem"    => array( ),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Account"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"details"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxcomment">//                "LoginLink"        => array( ),<br />//                "FeeRefund"        => array( ),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"ApplicationFee"</span><span class="syntaxdefault">    </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"find_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxdefault">                </span><span class="syntaxcomment">/*<br />                 * Verifier<br />                 * les Id.<br />                 */<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"ApplicationFeeRefund"</span><span class="syntaxdefault">    </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_applicationFeeId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId_refundId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfId_refundId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_applicationFeeId_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxcomment">//                "CountrySpec"        => array( ),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Recipient"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"delete_selfId_cardId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Transfer"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_transferId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"TransferReversal"</span><span class="syntaxdefault">    </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_transferId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_transferId_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_transferId_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Review"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Order"</span><span class="syntaxdefault">            </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfid"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"pay_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxcomment">//                "OrderItem"        => array( ),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Product"</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfId_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">),<br /></span><span class="syntaxcomment">//                "OrderReturn"        => array( ),<br /></span><span class="syntaxdefault">                </span><span class="syntaxstring">"Sku"</span><span class="syntaxdefault">             </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"create_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"find_selfId"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"update_selfid_params"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"all_params"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">            </span><span class="syntaxkeyword">);<br /><br /></span><span class="syntaxdefault">        if</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">array_key_exists</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$object</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> $traduct</span><span class="syntaxkeyword">))<br /></span><span class="syntaxdefault">        </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault">            $tmp_fonction </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> array</span><span class="syntaxkeyword">();<br /></span><span class="syntaxdefault">            $tmp_fonction </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> $traduct</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">$object</span><span class="syntaxkeyword">];<br /><br /></span><span class="syntaxdefault">            return</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$tmp_fonction</span><span class="syntaxkeyword">);<br /></span><span class="syntaxdefault">        </span><span class="syntaxkeyword">}<br /><br /></span><span class="syntaxdefault">        return</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">false</span><span class="syntaxkeyword">);<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">}<br /><br /></span><span class="syntaxdefault">?><br /></span><br /></span>
     
  2. ortolojf
    ortolojf WRInaute accro
    Inscrit:
    14 Août 2002
    Messages:
    2 817
    J'aime reçus:
    8
    Bonjour

    Problème résolu maintenant.

    Je suis en train de programmer la logique métier ( traitement des Events ), mais comment peut-on savoir quel que soit l'Event, à quel customer correspond l'event ?

    Pour l'instant, j'enregistre les Events dans la table MySQL "EVENTS".

    Merci beaucoup de votre aide.

    Respectueusement.
     
  3. ortolojf
    ortolojf WRInaute accro
    Inscrit:
    14 Août 2002
    Messages:
    2 817
    J'aime reçus:
    8
    Pardon

    Ma question n'avait aucun sens, puisque l'on met en bdd depuis le formulaire html, d'amont en aval, le customer_id, les logs des achats, disputes et autres étapes de vente.

    Pour l'instant, j'ai une classe StripeFSM, qui recevra et gérera les events dans le webhook.

    Actuellement je peaufine le formulaire.

    Amicalement.
     
  4. ortolojf
    ortolojf WRInaute accro
    Inscrit:
    14 Août 2002
    Messages:
    2 817
    J'aime reçus:
    8
    Bonjour

    J'ai quand même une question :

    Un formulaire Stripe ( de type v3 avec Elements ), donne un token au serveur, grâce auquel on peut créer le Customer et/ou la Charge.

    Ma question est :

    La seule solution pour repérer en amont, un Customer déjà existant, serait d'après son email de connexion sur le site ?

    Merci beaucoup de votre aide.

    Amicalement.
     
Chargement...
Similar Threads - problème API Stripe Forum Date
API Google Maps : problème avec l'auto-complétion Développement d'un site Web ou d'une appli mobile 1 Mai 2018
petit problème booléen... Le café de WebRankInfo Hier à 12:13
Problème de référencement de mon site Problèmes de référencement spécifiques à vos sites Jeudi à 14:05
Search Console Problème Fil d'Ariane : Vous devez indiquer name ou item.name Crawl et indexation Google, sitemaps 15 Octobre 2019
Problèmes d'indexation et robots.txt Crawl et indexation Google, sitemaps 14 Octobre 2019
Problème Keyword Planner AdWords 10 Octobre 2019
Url redirigée en 301 mais indexée : problème sitemap ? Crawl et indexation Google, sitemaps 9 Octobre 2019
Problème d'indexation Débuter en référencement 8 Octobre 2019
probléme file_get_contents Développement d'un site Web ou d'une appli mobile 4 Octobre 2019
problème tache cron Développement d'un site Web ou d'une appli mobile 3 Octobre 2019
  1. Ce site utilise des cookies. En continuant à utiliser ce site, vous acceptez l'utilisation des cookies.
    Rejeter la notice