I was able to put together a simple example that successfully renders a custom HTML input above the price of a plan and stores it into the basket. Below is that example.
Display:
Global
Triggers: onCPayBeforeDrawPlan
Type: Code
User: Automatic
Access: Everybody
Action
Method: HTML
Code:
Code:
<input type="text" name="planfields[[var1_id]][custom_field]" value="" />
Output
Display: Return
Save:
Global
Triggers: onCPayBeforeStorePaymentBasketUpdated
Type: Code
User: Automatic
Access: Everybody
Action
Method: PHP
Code:
Code:
$paymentBasket = $variables['var1'];
foreach ( $variables['var2'] as $paymentItem ) {
$field = 'planfields.' . ( $paymentItem->plan_id ?? 0 ) . '.custom_field';
$paymentBasket->setParam( $field, $input->getString( $field, $paymentBasket->getParam( $field, '', 'integrations' ) ), 'integrations' );
}
This will render a per-plan unique text field and store it to the basket. This would then be possible to be retrieved later depending on usage needs it might be necessary to push that parameter into the subscription itself, but probably not necessary.
To limit what plans the field displays on you'd add a condition to the first auto action against the plan id as follows.
Field: Custom > Value
Custom Value: [var1_id]
Operator: Equal To
Value: PLAN_ID_HERE
I hope this will be a reasonable starting point for either you or a developer to implement what you're needing.