AIサマリー
説明
について wpforms_square_process_get_payment_args_single
フィルタを使用すると、送信前にSquareシングルペイメントリクエストの引数を変更できます。これを使用して、動的データを注入したり、支払いメモでスマートタグを実行したり、メタデータを調整したりできます。
このフィルタを使用して、Squareのノートフィールド内でWPFormsスマートタグを実行し、Squareの取引詳細がフォーム値を含むことができるようにします。Squareの note
フィールドの文字数は500文字に制限されているので、それに応じて出力を切り詰めてください。
パラメータ | タイプ | 記述 |
---|---|---|
$args | 配列 | Squareの単一支払い引数。一般的なキーは以下の通りです。 amount_money , customer_id そして note . |
$process | プロセス | 現在のサブミッションのSquare Processインスタンス。へのアクセスを提供します。 $process->form_data そして $process->fields . |
ソース
wpforms\src\Integrations\Square\Process.php
例
// Process Smart Tags in the Square payment note and trim to 500 chars.
function wpf_dev_square_single_payment_args( $args, $process ) {
if ( isset( $args['note'] ) ) {
$note = apply_filters(
'wpforms_process_smart_tags',
$args['note'],
$process->form_data,
$process->fields,
0
);
$args['note'] = wp_html_excerpt( $note, 500 );
}
return $args;
}
add_filter( 'wpforms_square_process_get_payment_args_single', 'wpf_dev_square_single_payment_args', 10, 2 );