Ankündigung

Einklappen
Keine Ankündigung bisher.

API Variable

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • API Variable


    Guten Abend Community,

    ich versuche zur Zeit ein Zahlungsgateway für WHMCS zu realisieren.

    Ich habe momentan ein Blackout. Ich weiss die Antwort liegt vor meiner nase aber ich finde Sie nicht.

    Folgendes ich mus per API zuerst eine Invoice erstellen das klappt auch, sollte aber die Antwort des API's weiterverarbeiten.


    Ich habe momentan noch keinen Durchblick was mir mein API für eine Antwort gibt. Alsop am Schluss bekomme ich zurzeit einen String der aber erst erstellt wird durch mein script hier:


    PHP-Code:
    <?php


    spl_autoload_register
    (function($class) {
        
    $root dirname(__DIR__);
        
    $classFile $root '/test/' str_replace('\\''/'$class) . '.php';
        if (
    file_exists($classFile)) {
            require_once 
    $classFile;
        }
    });
    // $instanceName is a part of the url where you access your payrexx installation.
    // https://{$instanceName}.payrexx.com
    $instanceName 'f-i-s';

    // $secret is the payrexx secret for the communication between the applications
    // if you think someone got your secret, just regenerate it in the payrexx administration
    $secret 'WYoMcyutayYVlbU75P7q17ETbXaLsB';
    $payrexx = new \Payrexx\Payrexx($instanceName$secret);

    // init empty request object
    $invoice = new \Payrexx\Models\Request\Invoice();

    // info for payment link (reference id)
    $invoice->setReferenceId('Order number of my online shop application');

    // info for payment page (title, description)
    $invoice->setTitle('Online shop payment');
    $invoice->setDescription('Thanks for using Payrexx to pay your order');

    // administrative information, which provider to use (psp)
    // psp #1 = Payrexx' test mode, see http://developers.payrexx.com/docs/miscellaneous
    $invoice->setPsp(1);

    // internal data only displayed to administrator
    $invoice->setName('Online-Shop payment #001');

    // payment information
    $invoice->setPurpose('Shop Order #001');
    $amount 5.90;
    // don't forget to multiply by 100
    $invoice->setAmount($amount 100);
    // ISO code of currency, list of alternatives can be found here
    // http://developers.payrexx.com/docs/miscellaneous
    $invoice->setCurrency('CHF');

    // whether charge payment manually at a later date
    $invoice->setPreAuthorization(false);

    // subscription information if you want the customer to authorize a recurring payment
    // NOTE: This functionality is currently only available by using PAYMILL as a payment service provider.
    // This also does not work in combination with pre-authorization payments.
    //$invoice->setSubscriptionState(true);
    //$invoice->setSubscriptionInterval('P1M');
    //$invoice->setSubscriptionPeriod('P1Y');
    //$invoice->setSubscriptionCancellationInterval('P3M');

    // add contact information fields which should be filled by customer
    // it would be great to provide at least an email address field
    $invoice->addField($type 'email'$mandatory true$defaultValue 'my-customer@example.com');
    $invoice->addField($type 'company'$mandatory true$defaultValue 'Ueli Kramer Firma');
    $invoice->addField($type 'forename'$mandatory true$defaultValue 'Ueli');
    $invoice->addField($type 'surname'$mandatory true$defaultValue 'Kramer');
    $invoice->addField($type 'country'$mandatory true$defaultValue 'AT');
    $invoice->addField($type 'title'$mandatory true$defaultValue 'miss');
    $invoice->addField($type 'terms'$mandatory true);
    $invoice->addField($type 'custom_field_1'$mandatory true$defaultValue 'Value 001'$name 'Das ist ein Feld');

    // fire request with created and filled link request-object.
    try {
        
    $response $payrexx->create($invoice);
        
    var_dump($response);
    } catch (\
    Payrexx\PayrexxException $e) {
        print 
    $e->getMessage();
    }

    ich möchte aber die antwort in Variabeln das ich z.B
    PHP-Code:
    print $amount
    ausgeben kann.


    Hier könnt Ihr das Script mal ausführen dan seht Ihr was jetzt rauskommt.
    https://f-i-s.ch/test/InvoiceCreate.php

    Hier ist das SDK von Payrexx:

    https://github.com/payrexx/payrexx-php

    Ich hoffe Ihr könnt mir helfen. Ich bin zurzeit wirklich doof.

    Liebe Grüsse

    Alain
    Liebe Grüsse aus der Schweiz
    Alain
    never touch a running system

  • #2
    Zuerst mal solltest du deinen Secret-Code hier nicht öffentlich zugänglich machen

    Kommentar


    • #3
      Wiso? Wenn Problem gelöst wird der neu erstellt. Und zum testen braucht es Ihn und es ist e nur ein test account.
      Liebe Grüsse aus der Schweiz
      Alain
      never touch a running system

      Kommentar


      • #4
        Multipost -> http://phpforum.de/forum/showthread.php?t=285116
        Bitte Forenregeln beachten.

        Kommentar


        • #5
          Zitat von protestix Beitrag anzeigen
          Sorry, werde mich ab sofort dran halten!

          Liebe Grüsse aus der Schweiz
          Alain
          never touch a running system

          Kommentar


          • #6
            PHP-Code:
            str_replace('\\''/'$class
            Was soll diese Zeile bewirken?

            Falls Du Dateipfade dynamisch anpassen willst, nimm DIRECTORY_SEPARATOR
            bitcoin.de <- Meine Freelancerwährung

            Kommentar


            • #7
              Zitat von Alpha Beitrag anzeigen
              PHP-Code:
              str_replace('\\''/'$class
              Was soll diese Zeile bewirken?

              Falls Du Dateipfade dynamisch anpassen willst, nimm DIRECTORY_SEPARATOR
              Diese Zeile ist Teil der Behandlung möglicher Namespaces welche in $class enthalten sein können.
              Der Hinweis auf DIRECTORY_SEPARATOR ist an dieser Stelle falsch bzw. unpassend.

              Kommentar


              • #8
                PHP-Code:
                try {
                    
                $response $payrexx->create($invoice);
                    
                var_dump($response);
                } catch (\
                Payrexx\PayrexxException $e) {
                    print 
                $e->getMessage();

                Was steckt denn in $response drin? Das ist jedenfalls die Antwort der API...
                Über 90% aller Gewaltverbrechen passieren innerhalb von 24 Stunden nach dem Konsum von Brot.

                Kommentar


                • #9
                  Zitat von lstegelitz Beitrag anzeigen

                  Was steckt denn in $response drin? Das ist jedenfalls die Antwort der API...
                  Ich kann dir das selbst nicht sagen.

                  Die Doku von Payrexx ist sehr bescheiden.

                  Ich habe den Durchblick noch nicht. Es wird so viel von einer Datei in die andere verwisen.

                  Wie gesagt alles was ich habe ist die Sdk bezw. Die examples auf https://github.com/payrexx/payrexx-php

                  Gruss
                  Liebe Grüsse aus der Schweiz
                  Alain
                  never touch a running system

                  Kommentar


                  • #10
                    Was in $response steckt, musst DU prüfen, bspw. mit var_dump()
                    Competence-Center -> Enjoy the Informatrix
                    PHProcks!Einsteiger freundliche TutorialsPreComposed Packages

                    Kommentar


                    • #11
                      Gelöst.

                      Die variable Fülle ich z.B. mit
                      PHP-Code:
                      $link $response->getLink(); 
                      Danke für die Unterstützungs.

                      Liebe Grüsse aus der Schweiz
                      Alain
                      never touch a running system

                      Kommentar


                      • #12
                        Ok, also benutzt ihr eine API, die weder (gut) dokumentiert noch mit brauchbaren Beispielen unterlegt ist.
                        Und ihr habt selber nicht genug Erfahrung, so etwas selber in Erfahrung zu bringen (durch Debugging z.B.).

                        Halte ich alles in Allem für ungünstig, um es vorsichtig auszudrücken.

                        Über 90% aller Gewaltverbrechen passieren innerhalb von 24 Stunden nach dem Konsum von Brot.

                        Kommentar


                        • #13
                          Zu deiner Signatur, ich kenn das so:

                          Never change a running system.
                          Never run a changing system.
                          Change a never running system.

                          Kommentar

                          Lädt...
                          X