Skip to content

Insert Costum Data #273

Open
Open
@hrace009

Description

@hrace009

Hello, I have code like bellow:

public function postPaypalSubmit(Request $request)
    {
        $min = config('pw-config.payment.paypal.minimum');
        $max = config('pw-config.payment.paypal.maximum');
        $request->validate([
            'promo_code' => 'alpha_num',
        ]);
        $promo_code = $request->input('promo_code');

        if ( $request->dollars >= $min && $request->dollars <= $max ) {
            $transaction = $this->gateway->purchase([
                'amount' => number_format($request->dollars, 0, '.', ''),
                'currency' => config('pw-config.payment.paypal.currency'),
                'description' => __('donate.paypal.description', ['amount' => $request->tokens, 'currency' => config('pw-config.currency_name')]),
                'returnUrl' => route('app.donate.paypal.complete'),
                'cancelUrl' => route('app.donate.paypal'),
            ]);
            $response = $transaction->send();

            if ($response->isRedirect()) {
                $response->redirect();
            } else {
                echo $response->getMessage();
            }
        }
        else {
            return redirect()->back()->with('error', __('donate.paypal.transaction_range', ['min' => $min, 'max' => $max ]));
        }
    }

how i can insert $promo_code to $transaction?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions