//payment_profile_security_question_2 = //payment_profile_security_question_3 = //payment_profile_security_answer_1 = //payment_profile_security_answer_2 = //payment_profile_security_answer_3 = //payment_profile_status = enabled // First retrieve a Payment Profile without an id field, this will create a new empty Payment Profile; then fill it and save it. $newPaymentProfile = $oaConn->getPaymentProfile('', OAConnection::IDTYPE_API); $newPaymentProfile->payment_profile_first_name = 'Jane' . rand(); $newPaymentProfile->payment_profile_last_name = 'Eyre' . rand(); $newPaymentProfile->payment_profile_email_address = 'janeeyre' . rand() . '@thornfield.hall'; $newPaymentProfile->payment_profile_password = '******'; $newPaymentProfile->payment_profile_external_id = $newPaymentProfile->payment_profile_email_address; print "Saving Payment Profile..." . PHP_EOL; printObj($newPaymentProfile, 1); $paymentProfile = $oaConn->savePaymentProfile($newPaymentProfile); if (isset($paymentProfile->payment_profile_id)) { print "Saved Payment Profile to confirm save retrieve it using an identifier..." . PHP_EOL; // The reponse from savePaymentProfile was actually the new Profile; // we retrieve it here separately and just to demonstrate it worked let's query using the APP Id (instead of the API ID). $response = $oaConn->getPaymentProfile($paymentProfile->payment_profile_external_id, OAConnection::IDTYPE_APP); printObj($response, 1); } else { printObj($paymentProfile, 1); } } catch (Exception $e) { echo $e->getMessage() . PHP_EOL; } if ($connected) { print "Disconnecting "; $res = $oaConn->disconnect();
print "Modifying Payment Schedule: " . $paySched->payment_schedule_id . PHP_EOL; $paymentSchedule = $oaConn->getPaymentSchedule($paySched->payment_schedule_id); $payment_schedule_amount = $paymentSchedule->payment_schedule_amount; $paymentSchedule->payment_schedule_amount = $payment_schedule_amount + 100.0; $response = $oaConn->savePaymentSchedule($paymentSchedule); if (isset($response->payment_schedule_id)) { print "Updated Payment Schedule: was-'" . $payment_schedule_amount . "' is now-'" . $response->payment_schedule_amount . "'" . PHP_EOL; } } // Modifying this Payment Profile - make some changes and save them back // Here we'll add a number 0 through 10 (incrementing each time this demo is run) to their last name echo "Modifying the Payment Profile..." . PHP_EOL; $lname = $paymentProfile->payment_profile_last_name; $paymentProfile->payment_profile_last_name = substr($lname, 0, 4) . strval(intval(substr($lname, -1, 1)) + 1); print "Setting the last name to: " . $paymentProfile->payment_profile_last_name . PHP_EOL; $response = $oaConn->savePaymentProfile($paymentProfile); print "Updated Payment Profile: was-'" . $lname . "' is now-'" . $response->payment_profile_last_name . "'" . PHP_EOL; print PHP_EOL; } // Let's look at the available Payment Types // Payment types are specific to your organization; make them up as you need // These control the descriptions that end users see on their statements // and set a default organization account the money is credited/debited to/from echo "Getting Payment Types..." . PHP_EOL; $paymentTypes = $oaConn->getPaymentTypes(); $payment_type_id = ''; foreach ($paymentTypes as $paymentType) { print "Payment Type: " . $paymentType->payment_type_name . PHP_EOL; printObj($paymentType, 1); if ($paymentType->payment_type_transaction_type == 'debit') { $payment_type_id = $paymentType->payment_type_id;